Purchasing with Puppeteer fails when running cron job
See original GitHub issueCurrently using the latest image 836bd35be10d
Describe the bug
When running the cronjob to purchase a game, the API request fails with error 400 as seen in other other bugs and so falls back on Puppeteer (short). It logs my email, but then does nothing after that.
If I restart the docker container with runOnStartup: true
, it will get the same 400 response from the API, but this time will create a captcha request email, and complete the purchase through puppeteer one the captcha is filled.
Screenshots or Logs
[2021-12-22 16:05:25.761 +0000] INFO : Purchasing Mutant Year Zero: Road to Eden
[2021-12-22 16:05:25.761 +0000] TRACE: Request for purchase token
user: "me@email.com"
searchParams: {
"namespace": "4756b80eb0f74d45b77922e54052cfed",
"offers": "9651fd57c8a34e81949aab28a084ced7"
}
url: "https://www.epicgames.com/store/purchase"
[2021-12-22 16:05:27.108 +0000] DEBUG: purchaseToken
user: "me@email.com"
purchaseToken: "c96c60ec4a404a3fa64ddc529fd2df51"
[2021-12-22 16:05:27.109 +0000] TRACE: Order preview request
user: "me@email.com"
body: {
"canQuickPurchase": false,
"country": "US",
"eulaId": null,
"lineOffers": [
{
"appliedNsOfferIds": [],
"namespace": "4756b80eb0f74d45b77922e54052cfed",
"offerId": "9651fd57c8a34e81949aab28a084ced7",
"quantity": 1,
"title": "Mutant Year Zero: Road to Eden",
"upgradePathId": null
}
],
"locale": "en_US",
"offers": null,
"setDefault": false,
"syncToken": "",
"useDefaultBillingAccount": true
}
url: "https://payment-website-pci.ol.epicgames.com/purchase/order-preview"
[2021-12-22 16:05:27.620 +0000] TRACE: Order preview response
user: "me@email.com"
[2021-12-22 16:05:27.621 +0000] TRACE: Confirm order request
user: "me@email.com"
body: {
"eulaId": null,
"useDefaultBillingAccount": false,
"country": "US",
"offers": null,
"lineOffers": [
{
"appliedNsOfferIds": [],
"namespace": "4756b80eb0f74d45b77922e54052cfed",
"offerId": "9651fd57c8a34e81949aab28a084ced7",
"quantity": 1,
"title": "Mutant Year Zero: Road to Eden",
"upgradePathId": null
}
],
"totalAmount": 0,
"setDefault": false,
"syncToken": "ec01650c-8745-4e10-97f3-2539f313e1d7",
"canQuickPurchase": true,
"locale": "en_US",
"affiliateId": "",
"creatorSource": ""
}
url: "https://payment-website-pci.ol.epicgames.com/purchase/confirm-order"
[2021-12-22 16:05:28.029 +0000] WARN : Error encountered during purchase
user: "me@email.com"
errorBody: {
"error": true,
"message": "We could not confirm your purchase at this time. Please try again later.",
"order": null,
"syncToken": "f6d92509-76fe-4835-b52f-4ed40894c34b"
}
code: 400
[2021-12-22 16:05:28.030 +0000] WARN (HTTPError): Response code 400 (Bad Request)
HTTPError: Response code 400 (Bad Request)
at Request.<anonymous> (/usr/app/node_modules/got/dist/source/as-promise/index.js:117:42)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
[2021-12-22 16:05:28.030 +0000] WARN : API purchase experienced an error, trying puppeteer purchase
[2021-12-22 16:05:28.031 +0000] DEBUG: hcaptchaAccessibilityUrl not configured, captchas are less likely to be bypassed. Follow this guide to set it up: https://github.com/claabs/epicgames-freegames-node#hcaptcha-accessibility-cookies
[2021-12-22 16:05:28.037 +0000] DEBUG: Purchasing with puppeteer (short)
user: "me@email.com"
Additional context No hCaptchaURL setup since it is marked as not working in the docs Logs are in TRACE mode
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Puppeteer fails to execute from Crontab but works when ...
I want to make a Node.js Puppeteer cronjob, but Puppeteer breaks without any errors only when executed from a cronjob.
Read more >Puppeteer don´t run with cronjobs · Issue #4759
I want to run node.js process as a cron job, but process are not running well. My javascript code is just the first...
Read more >Web Scraping with Puppeteer & Node.js: Chrome Automation
Web Scraping with Puppeteer & Node.js: Chrome Automation. Watch later. Share. Copy link. Info. Shopping. Tap to unmute.
Read more >Node.js Web Scraping - 2 - Cron Scheduling & Email Alerting
In the second part of our web scraping with Node.js & Puppeteer series, we wrap up by setting our scraper on an automatic...
Read more >Create a Remote Jobs Automated Scraping Bot on Nodejs ...
Create a Remote Jobs Automated Scraping Bot on Nodejs and Puppeteer with (Express and Crontab). Video Tutorial.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes. A captcha is served for every purchase now. That’s just a thing on Epic’s side.
I’ll close this now since it’s kind of two issues at once. Feel free to open a new issue if something else pops up.
I now get a captcha request each day to complete the purchase in the dev branch, assuming that’s the behaviour I should expect?