claabs / epicgames-freegames-node

Automatically login and find available free games the Epic Games Store. Sends you a prepopulated checkout link so you can complete the checkout after logging in. Supports multiple accounts, login sessions, and scheduled runs.
https://hub.docker.com/r/charlocharlie/epicgames-freegames
MIT License
1.34k stars 91 forks source link

Container exits #377

Closed brhahlen closed 7 months ago

brhahlen commented 7 months ago

Describe the bug

The program exits in the container

Screenshots or Logs

epicgames  | [2024-02-14 05:59:30.504 +0100] ERROR: Timed out after 21567974 ms
epicgames  |     user: "me@me.me"
epicgames  |     err: {
epicgames  |       "type": "Error",
epicgames  |       "message": "Timed out after 21567974 ms",
epicgames  |       "stack":
epicgames  |           Error: Timed out after 21567974 ms
epicgames  |               at Timeout._onTimeout (/usr/app/src/device-login.ts:78:29)
epicgames  |               at listOnTimeout (node:internal/timers:569:17)
epicgames  |               at processTimers (node:internal/timers:512:7)
epicgames  |     }
epicgames  | [2024-02-14 05:59:30.547 +0100] WARN: Current version
epicgames  |     COMMIT_SHA: "a9756df29cf752f3b5bafab03a44b6cd9b970b77"
epicgames  |     BRANCH: "master"
epicgames  |     DISTRO: "alpine"
epicgames  | [2024-02-14 05:59:30.548 +0100] INFO: Exiting successfully

Additional context

claabs commented 7 months ago

This was intentionally added in https://github.com/claabs/epicgames-freegames-node/commit/89c8ea44daa24ddb005907e6a175a3016fd5aa9e to ensure the program runs each scheduled time, so the device token doesn't expire and ask you to log in daily. Essentially, the notification must timeout before the next run.

You don't provide much context in this issue, but I assume a login request notification was sent and ignored. If you complete the login, it will resolve itself.

brhahlen commented 7 months ago

Got it. The cron runs every 6 hours (0 0/6 * * *), and the problem occurs between the midnight one and the one at 6 am.

What happens now is that because the program seems to exit, I can't complete the login notification, as I get a bad gateway error from my reverse proxy (as the webserver doesn't work). When I restart the container, it works properly again. Would it help by changing the cron to run every 12 hours? Or is that too long?

brhahlen commented 7 months ago

I've changed the cron config to "0 3,9,15,21 * * *", Hopefully, that will resolve the issue :)

claabs commented 7 months ago

What happens now is that because the program seems to exit, I can't complete the login notification, as I get a bad gateway error from my reverse proxy (as the webserver doesn't work).

I think it's flipped actually. The program is exiting after 6 hours of waiting for you to log in. You should really only have to log in once ever. If you're logging in multiple times, maybe there's something wrong persisting the token?

brhahlen commented 7 months ago

The program is exiting after 6 hours of waiting for you to log in

That makes sense, as the notification comes at midnight, and the next run is at 06:00, which is when I usually have not woken up yet.

You should really only have to log in once ever. If you're logging in multiple times, maybe there's something wrong persisting the token?

I've had to log in daily, since when I started to run the container. I used to get the notification at midnight, and then I could login in the morning (usually would do that at around 7/7:30).

brhahlen commented 7 months ago

I'm waiting to see more results, but I have not had the login prompt yet. My theory is that the crontab of 0 0/6 * * * was not picked up properly in the container, which is why I only got the notification once a day (midnight) and it never "expired". Will check over the next few days.

brhahlen commented 7 months ago

Just did a restart of the container, due to the latest container update, and it automatically logged in. So I do think that the cron notation of 0 0/6 * * * was not working properly, which caused the daily login messages (as it would only run once per day).

Everything works fine now!