Closed GothicIII closed 1 year ago
Thanks for the detailed description.
(Your first crontab line shows prime-gaming.js
- I assume that's a typo.)
As long as the environment variables are set properly, dotenv should pick them up. You could include env
to check.
Yea, X shouldn't be needed, but whether you get a captcha challenge depends on a number of factors, so SHOW=1
may still help.
To make sure that you actually do get a captcha challenge, run with RECORD=1
which will record a video to data/record/*.webm
and a .har
archive you can load in Chrome devtools to check all network requests/responses.
Any update?
Yesterday when I wanted to check the script asked me to login again. I claimed the game manually due to expiring and now I have to wait another week because I own already the current game.
I'll try next weekend again.
Strange, for me it stays logged in at least a week.
So I tried it again. Ran it with:
RECORD=1; node /home/<user>/free-games-claimer/epic-games.js >> /tmp/freegames_epic.log 2>&1
Nothing was recorded where freegames is installed. There is no record directory inside data. The error is still the same like in the opening post. I don't know how to debug this within cron when running 'node epic-games.js' from terminal works without issues. SHOW=1 won't have any effect when ran from cron since it does not spawn any x session I could look into.
Btw. The prime-plugin works without issues.
EDIT: Made a mistake. Shouldn't have used a semicolon. Hugh another week, another try. See you in a week.
🙈
Debugging the last step of the order is annoying. For stuff before, you could at least run with DRYRUN=1
.
If you don't want to wait until Thursday, you could make a new epic-games account (for your family/pet) and try it there.
@GothicIII Any update on this?
I'll close this for now. Did you figure out what's the issue?
As you wrote, env
is minimal with cronjobs: https://askubuntu.com/questions/23009/why-crontab-scripts-are-not-working
But that's not a problem here since it runs the script.
Setting env vars without semicolon, yes.
Alternatively, you could also try running with pm2
: https://pm2.keymetrics.io/docs/usage/quick-start/
I decided to open a new issue since other issues are unrelated.
My environment consists of debian bookworm (upgraded from bullseye yesterday) with qemu-kvm. I got a VM which does other tasks so It has enough ressource (8GB RAM) and the internet access is not filtered.
I configured it to run the cronjobs for free-games-claimer. Sadly I can't link to the tutorial I used to configure everything; it seems to be taken down. Since only epic has free offers every week I can only refer to the epic part. I don't know if the other plugins are affected or not.
If I run
node epic-games
from terminal over a ssh-session with X11 forwaring the script runs successfully and claims the games. I configured crontab for the user like this:00 20 * * * node /home/user/free-games-claimer/prime-gaming.js >>/tmp/freegames_prime.log 2>&1
At 08:00PM it is executed and I get following output:
It was speculated that the environment variables from the user are missing if ran from cron. I tried to fix the issue by editing the crontab like this:
00 20 * * * . $HOME/.profile; node /home/<user>/free-games-claimer/epic-games.js >> /tmp/freegames_epic.log 2>&1
The issue persists. If the games are claimed already, the script exits normally. I am pretty sure I can rule out X11 since it works from a local session were no X is configured (bare-metal env). I don't want to install docker just for this task. It would literally install hundreds of libraries I don't need otherwise. And nested VMs would just eat more ressources.
It would be helpful to use SHOW=1 for debugging to see what is really going on but since it runs over cron I don't know how to hijack graphical sessions for this purpose... And like already mentioned manual running the script always succeeds...
Can somebody help?