Closed nitanmarcel closed 1 year ago
1+ Having same issue.
EDIT: I changed "browserNavigationTimeout": to 30000 and that seems to have fixed the issue for me..
1+ Having same issue.
EDIT: I changed "browserNavigationTimeout": to 30000 and that seems to have fixed the issue for me..
We have different issues. I have it set at 120000
which is higher than what you have
I suppose my page is different, as it needs to also detect this, but thing is, it doesn't show in screenshots:
Similar issue, stuck in waiting for the receipt forever, then the checkout page with a circle on the center screen, non-stop spinning.
> epicgames-freegames-node@4.1.0 entrypoint-config
> node dist/src/entrypoint-config.js
Setting timezone: Asia/Shanghai
Run on startup: true
[2022-12-16 21:29:16.326 +0800] INFO: Started epicgames-freegames-node
COMMIT_SHA: "80a651a060bb4c2313886bfa4bbffb7a0683b028"
BRANCH: "master"
DISTRO: "alpine"
[2022-12-16 21:29:16.328 +0800] DEBUG: Performing version check
PROJECT_NAME: "epicgames-freegames-node"
BRANCH: "master"
COMMIT_SHA: "80a651a060bb4c2313886bfa4bbffb7a0683b028"
[2022-12-16 21:29:17.032 +0800] INFO: Checking free games for my.email@gmail.com
user: "my.email@gmail.com"
[2022-12-16 21:29:17.032 +0800] DEBUG: Launching a new browser
user: "my.email@gmail.com"
[2022-12-16 21:29:17.624 +0800] DEBUG: Logging in with puppeteer
user: "my.email@gmail.com"
[2022-12-16 21:29:17.624 +0800] DEBUG: Launching a new browser
user: "my.email@gmail.com"
[2022-12-16 21:29:18.011 +0800] DEBUG: Launching a new page
user: "my.email@gmail.com"
[2022-12-16 21:29:40.274 +0800] INFO: Successfully refreshed login
user: "my.email@gmail.com"
[2022-12-16 21:29:41.036 +0800] INFO: searchStrategy is `all`: searching for weekly and promotional games
user: "my.email@gmail.com"
[2022-12-16 21:29:41.037 +0800] DEBUG: Getting current weekly free games list
user: "my.email@gmail.com"
[2022-12-16 21:29:41.044 +0800] DEBUG: Logging in with puppeteer
user: "my.email@gmail.com"
[2022-12-16 21:29:41.044 +0800] DEBUG: Launching a new browser
user: "my.email@gmail.com"
[2022-12-16 21:29:41.552 +0800] DEBUG: Launching a new page
user: "my.email@gmail.com"
[2022-12-16 21:30:10.394 +0800] DEBUG: Getting product info using productSlug
user: "my.email@gmail.com"
productSlug: "bloons-td-6-bf95a0"
offerType: "OTHERS"
[2022-12-16 21:30:11.318 +0800] WARN: Failed to lookup weekly free games
user: "my.email@gmail.com"
err: {
"type": "Error",
"message": "Evaluation failed: Error: {\"error\":true}\n at pptr://__puppeteer_evaluation_script__:7:23",
"stack":
Error: Evaluation failed: Error: {"error":true}
at pptr://__puppeteer_evaluation_script__:7:23
at ExecutionContext._ExecutionContext_evaluate (/usr/app/node_modules/puppeteer/src/common/ExecutionContext.ts:279:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at ExecutionContext.evaluate (/usr/app/node_modules/puppeteer/src/common/ExecutionContext.ts:145:12)
at PuppetFreeGames.request (/usr/app/src/puppet/free-games.ts:40:18)
at PuppetFreeGames.getProduct (/usr/app/src/puppet/free-games.ts:223:33)
at /usr/app/src/puppet/free-games.ts:187:33
at async Promise.all (index 0)
at PuppetFreeGames.getWeeklyFreeGames (/usr/app/src/puppet/free-games.ts:171:7)
at PuppetFreeGames.getAllFreeGames (/usr/app/src/puppet/free-games.ts:338:27)
at redeemAccount (/usr/app/src/index.ts:38:20)
}
[2022-12-16 21:30:11.403 +0800] DEBUG: Getting global free games
user: "my.email@gmail.com"
[2022-12-16 21:30:41.586 +0800] DEBUG: Retrieved catalog data for 1037 games
user: "my.email@gmail.com"
[2022-12-16 21:30:41.587 +0800] DEBUG: Found 1 unique free games in catalog
user: "my.email@gmail.com"
[2022-12-16 21:30:41.588 +0800] INFO: Available free games
user: "my.email@gmail.com"
availableGames: [
"Bloons TD 6"
]
[2022-12-16 21:30:41.588 +0800] DEBUG: Checking ownership and prerequesites on available games
user: "my.email@gmail.com"
[2022-12-16 21:30:41.588 +0800] DEBUG: Getting offers validation info
user: "my.email@gmail.com"
offerId: "b27e3b556f1048b9824c7196f32afceb"
namespace: "6a8dfa6e441e4f2f9048a98776c6077d"
[2022-12-16 21:30:41.880 +0800] DEBUG: Offers validation response
user: "my.email@gmail.com"
offerId: "b27e3b556f1048b9824c7196f32afceb"
namespace: "6a8dfa6e441e4f2f9048a98776c6077d"
validations: {
"conflictingOffers": [],
"missingPrerequisites": [],
"fullyOwnedOffers": [],
"possiblePartialUpgradeOffers": [],
"unablePartiallyUpgradeOffers": []
}
[2022-12-16 21:30:41.880 +0800] INFO: Unpurchased free games
user: "my.email@gmail.com"
purchasableGames: [
"Bloons TD 6"
]
[2022-12-16 21:30:41.894 +0800] INFO: Purchasing Bloons TD 6
user: "my.email@gmail.com"
[2022-12-16 21:30:41.914 +0800] DEBUG: Logging in with puppeteer
user: "my.email@gmail.com"
[2022-12-16 21:30:41.914 +0800] DEBUG: Launching a new browser
user: "my.email@gmail.com"
[2022-12-16 21:30:42.365 +0800] DEBUG: Launching a new page
user: "my.email@gmail.com"
[2022-12-16 21:30:47.217 +0800] INFO: Loading purchase page
user: "my.email@gmail.com"
purchaseUrl: "https://www.epicgames.com/store/purchase?highlightColor=0078f2&offers=1- d-b27e3b556f1048b9824c7196f32afceb&orderId&purchaseToken&showNavigation=true"
[2022-12-16 21:32:23.101 +0800] DEBUG: Clicking placeOrderButton
user: "my.email@gmail.com"
[2022-12-16 21:32:28.859 +0800] DEBUG: Waiting for receipt
user: "my.email@gmail.com"
[2022-12-16 21:40:29.238 +0800] WARN: waiting for function failed: timeout 480000ms exceeded
user: "my.email@gmail.com"
err: {
"type": "TimeoutError",
"message": "waiting for function failed: timeout 480000ms exceeded",
"stack":
TimeoutError: waiting for function failed: timeout 480000ms exceeded
at new WaitTask (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:938:28)
at DOMWorld.waitForFunction (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:844:22)
at Frame.waitForFunction (/usr/app/node_modules/puppeteer/src/common/FrameManager.ts:1449:28)
at Page.waitForFunction (/usr/app/node_modules/puppeteer/src/common/Page.ts:3472:29)
at initPurchase (/usr/app/src/puppet/purchase.ts:84:14)
at PuppetPurchase.purchaseShort (/usr/app/src/puppet/purchase.ts:117:7)
at redeemAccount (/usr/app/src/index.ts:43:9)
at async Promise.all (index 0)
at main (/usr/app/src/index.ts:69:5)
"name": "TimeoutError"
}
[2022-12-16 21:40:29.370 +0800] ERROR: Encountered an error during browser automation. Saved a screenshot and page HTML for debugging purposes.
user: "my.email@gmail.com"
errorImage: "config/error-2022-12-16T13-40-28.879Z.png"
errorHtml: "config/error-2022-12-16T13-40-28.879Z.html"
[2022-12-16 21:40:29.371 +0800] INFO: Asking a human for help...
user: "my.email@gmail.com"
[2022-12-16 21:40:31.724 +0800] INFO: Go to this URL and do something
user: "my.email@gmail.com"
url: "https://puny-teeth-obey-212-107-28-27.loca.lt/?targetId= "
The refund agreement is already handled.
I've tried several accounts including EU accounts and I can't reproduce this issue. There's not much I can do to debug it at this point.
The refund agreement is already handled.
I've tried several accounts including EU accounts and I can't reproduce this issue. There's not much I can do to debug it at this point.
It can't see the refund agreement
[2022-12-16 15:19:24.222 +0000] TRACE: No EU "Refund and Right of Withdrawal Information" dialog presented
[2022-12-16 15:19:13.145 +0000] INFO: Purchasing Bloons TD 6
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:13.149 +0000] DEBUG: Logging in with puppeteer
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:13.149 +0000] DEBUG: Launching a new browser
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:13.278 +0000] DEBUG: Launching a new page
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:13.333 +0000] TRACE: devtools://devtools/bundled/inspector.html?ws=127.0.0.1:39347/devtools/page/4EC9EA9A67E300D3FDBBEAAF5C7B266D
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:13.476 +0000] INFO: Loading purchase page
user: "nitan.marcel@gmail.com"
purchaseUrl: "https://www.epicgames.com/store/purchase?highlightColor=0078f2&offers=1-6a8dfa6e441e4f2f9048a98776c6077d-b27e3b556f1048b9824c7196f32afceb&orderId&purchaseToken&showNavigation=true"
[2022-12-16 15:19:20.937 +0000] TRACE: Waiting for cookieDialog
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:20.945 +0000] TRACE: Clicking cookieDialog
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:21.085 +0000] TRACE: Waiting for placeOrderButton
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:21.091 +0000] DEBUG: Clicking placeOrderButton
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:24.222 +0000] TRACE: No EU "Refund and Right of Withdrawal Information" dialog presented
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:24.222 +0000] DEBUG: Waiting for receipt
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:24.222 +0000] TRACE: Waiting for hcaptcha iframe
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:54.317 +0000] WARN: waiting for function failed: timeout 30000ms exceeded
user: "nitan.marcel@gmail.com"
err: {
"type": "TimeoutError",
"message": "waiting for function failed: timeout 30000ms exceeded",
"stack":
TimeoutError: waiting for function failed: timeout 30000ms exceeded
at new WaitTask (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:938:28)
at DOMWorld.waitForFunction (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:844:22)
at Frame.waitForFunction (/usr/app/node_modules/puppeteer/src/common/FrameManager.ts:1449:28)
at Page.waitForFunction (/usr/app/node_modules/puppeteer/src/common/Page.ts:3472:29)
at initPurchase (/usr/app/src/puppet/purchase.ts:84:14)
at PuppetPurchase.purchaseShort (/usr/app/src/puppet/purchase.ts:117:7)
at redeemAccount (/usr/app/src/index.ts:43:9)
at async Promise.all (index 0)
at main (/usr/app/src/index.ts:69:5)
"name": "TimeoutError"
}
[2022-12-16 15:19:54.348 +0000] ERROR: Encountered an error during browser automation. Saved a screenshot and page HTML for debugging purposes.
user: "nitan.marcel@gmail.com"
errorImage: "config/error-2022-12-16T15-19-54.232Z.png"
errorHtml: "config/error-2022-12-16T15-19-54.232Z.html"
[2022-12-16 15:19:54.348 +0000] INFO: Asking a human for help...
user: "nitan.marcel@gmail.com"
[2022-12-16 15:19:54.352 +0000] INFO: Go to this URL and do something
user: "nitan.marcel@gmail.com"
url: "http://127.0.0.1:3000/?targetId=4EC9EA9A67E300D3FDBBEAAF5C7B266D"
[2022-12-16 15:19:54.353 +0000] TRACE: Sending telegram notification
user: "nitan.marcel@gmail.com"
reason: "PURCHASE ERROR"
[2022-12-16 15:19:54.354 +0000] TRACE: Sending json payload
user: "nitan.marcel@gmail.com"
reason: "PURCHASE ERROR"
jsonPayload: {
"chat_id": "942356877",
"text": "epicgames\\-freegames\\-node\nreason: PURCHASE ERROR,\naccount: nitan\\.marcel@gmail\\.com\nurl: [Click here](http://127.0.0.1:3000/?targetId=4EC9EA9A67E300D3FDBBEAAF5C7B266D)",
"disable_web_page_preview": true,
"parse_mode": "MarkdownV2"
}
Here's my html code for the refund dialog
<div class="payment-confirm payment-confirm--agreement">
<div class="payment-confirm__wrap">
<div class="payment-confirm__title">
<span>Refund and Right of Withdrawal Information</span>
</div>
<div class="payment-confirm__body">
<span>
<div class="withdraw-rules">
<p>
<span>Any game purchased on the Epic Games Store is eligible for refund within 14 days of purchase (or for prepurchases, 14 days from release) if you have played for less than 2 hours.</span>
</p>
<p>
<span>EU residents have a right at law to withdraw from a purchase of digital content, without giving any reason, for a period of 14 days after that purchase. <a class="highlight" href="https://www.epicgames.com/site/right-of-withdrawal" target="_blank">Click here to find out more</a>. <strong>However, in order to proceed, you expressly consent to waive your right to withdraw from this purchase and acknowledge that by giving this consent you will lose this right after downloading the software and playing for 2 hours.</strong>
</span>
</p>
</div>
</span>
</div>
<div class="payment-confirm__actions">
<button class="payment-btn payment-confirm__btn payment-btn--default">
<div class="payment-loading">
<div class="payment-loading__container">
<span>Cancel</span>
</div>
</div>
</button>
<button class="payment-btn payment-confirm__btn payment-btn--primary">
<div class="payment-loading">
<div class="payment-loading__container">
<span>I Agree</span>
</div>
</div>
</button>
</div>
</div>
</div>
The program waits 3 seconds for the refund dialog to appear. I guess it's possible that it could be loading slower than that. I just don't understand why it would be an issue now. It's been like this for a long time now.
The program waits 3 seconds for the refund dialog to appear. I guess it's possible that it could be loading slower than that. I just don't understand why it would be an issue now. It's been like this for a long time now.
Maybe epic has some issues?
Tho If I open the dialog myself it opens fast
@claabs with 10 seconds wait the same thing happens
[2022-12-16 15:35:35.394 +0000] DEBUG: Clicking placeOrderButton
user: "nitan.marcel@gmail.com"
[2022-12-16 15:35:45.534 +0000] TRACE: No EU "Refund and Right of Withdrawal Information" dialog presented
I changed the purchase flow a bit to remove the dependency on 3 second waits. When the build finishes, pull the latest and see if that helps at all.
I changed the purchase flow a bit to remove the dependency on 3 second waits. When the build finishes, pull the latest and see if that helps at all.
will need to make another account later. The new free game that they pushed is already in my library. maybe @zzz6839 can try it since he also had the same issue
can confirm the latest commit worked, at least for now.
@claabs for me the error still persists. This time the accept cookies button isn't pressed too
[2022-12-18 17:08:28.775 +0000] DEBUG: Waiting for receipt, captcha, refund dialog, or error
user: "nitan.marcel@gmail.com"
[2022-12-18 17:08:58.892 +0000] WARN: waiting for function failed: timeout 30000ms exceeded
user: "nitan.marcel@gmail.com"
err: {
"type": "TimeoutError",
"message": "waiting for function failed: timeout 30000ms exceeded",
"stack":
TimeoutError: waiting for function failed: timeout 30000ms exceeded
at new WaitTask (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:938:28)
at DOMWorld.waitForFunction (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:844:22)
at Frame.waitForFunction (/usr/app/node_modules/puppeteer/src/common/FrameManager.ts:1449:28)
at Page.waitForFunction (/usr/app/node_modules/puppeteer/src/common/Page.ts:3472:29)
at PuppetPurchase.waitForPurchaseEvent (/usr/app/src/puppet/purchase.ts:36:10)
at initPurchase (/usr/app/src/puppet/purchase.ts:96:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at PuppetPurchase.purchaseShort (/usr/app/src/puppet/purchase.ts:137:7)
at redeemAccount (/usr/app/src/index.ts:43:9)
at async Promise.all (index 0)
"name": "TimeoutError"
}
[2022-12-18 17:08:58.934 +0000] ERROR: Encountered an error during browser automation. Saved a screenshot and page HTML for debugging purposes.
user: "nitan.marcel@gmail.com"
errorImage: "config/error-2022-12-18T17-08-58.783Z.png"
errorHtml: "config/error-2022-12-18T17-08-58.783Z.html"
[2022-12-18 17:08:58.934 +0000] INFO: Asking a human for help...
user: "nitan.marcel@gmail.com"
[2022-12-18 17:08:58.938 +0000] INFO: Go to this URL and do something
user: "nitan.marcel@gmail.com"
url: "http://127.0.0.1:3000/?targetId=CFE66512628F5493BDD0E7D61FDEF9F8"
[2022-12-18 17:08:58.939 +0000] TRACE: Sending telegram notification
user: "nitan.marcel@gmail.com"
reason: "PURCHASE ERROR"
[2022-12-18 17:08:58.939 +0000] TRACE: Sending json payload
user: "nitan.marcel@gmail.com"
reason: "PURCHASE ERROR"
jsonPayload: {
"chat_id": "942356877",
"text": "epicgames\\-freegames\\-node\nreason: PURCHASE ERROR,\naccount: nitan\\.marcel@gmail\\.com\nurl: [Click here](http://127.0.0.1:3000/?targetId=CFE66512628F5493BDD0E7D61FDEF9F8)",
"disable_web_page_preview": true,
"parse_mode": "MarkdownV2"
}
I'm also having this issue, running this in The Netherlands. I will set my log level to trace and post an update here once it has happened again.
Having the same issue on latest docker image. I tried changing browserNavigationTimeout to 60000 and 120000 with no luck. Can the cookie dialog be the issue? The logs say "Waiting for order button or cookie dialog" and then "Clicking placeOrderButton" but in the attached screenshot the button has not been pressed and there is a cookie dialog.
> epicgames-freegames-node@4.1.0 entrypoint-config
> node dist/src/entrypoint-config.js
Setting timezone: UTC
Run on startup: true
[2023-01-20 11:09:33.220 +0000] INFO: Started epicgames-freegames-node
COMMIT_SHA: "67778639ee9bc09c8a543f7e7904116f850dcabc"
BRANCH: "master"
DISTRO: "alpine"
[2023-01-20 11:09:33.221 +0000] DEBUG: Performing version check
PROJECT_NAME: "epicgames-freegames-node"
BRANCH: "master"
COMMIT_SHA: "67778639ee9bc09c8a543f7e7904116f850dcabc"
[2023-01-20 11:09:33.701 +0000] INFO: Checking free games for ***@hotmail.com
[2023-01-20 11:09:33.702 +0000] DEBUG: Launching a new browser
[2023-01-20 11:09:34.051 +0000] DEBUG: Logging in with puppeteer
[2023-01-20 11:09:34.051 +0000] DEBUG: Launching a new browser
[2023-01-20 11:09:34.302 +0000] DEBUG: Launching a new page
[2023-01-20 11:09:42.481 +0000] INFO: Successfully refreshed login
[2023-01-20 11:09:42.907 +0000] INFO: searchStrategy is `all`: searching for weekly and promotional games
[2023-01-20 11:09:42.908 +0000] DEBUG: Getting current weekly free games list
[2023-01-20 11:09:42.911 +0000] DEBUG: Logging in with puppeteer
[2023-01-20 11:09:42.911 +0000] DEBUG: Launching a new browser
[2023-01-20 11:09:43.161 +0000] DEBUG: Launching a new page
[2023-01-20 11:09:51.684 +0000] DEBUG: Getting global free games
[2023-01-20 11:09:52.433 +0000] DEBUG: Retrieved catalog data for 16 games
[2023-01-20 11:09:52.433 +0000] DEBUG: Found 1 unique free games in catalog
[2023-01-20 11:09:52.434 +0000] INFO: Available free games
availableGames: [
"Epistory - Typing Chronicles"
]
[2023-01-20 11:09:52.435 +0000] DEBUG: Checking ownership and prerequesites on available games
[2023-01-20 11:09:52.435 +0000] DEBUG: Getting offers validation info
offerId: "63352c1c0eed4ab9a640dafee08eff54"
namespace: "6a6d54e5b4ef4fb0b3dad1d02a320376"
[2023-01-20 11:09:52.598 +0000] DEBUG: Offers validation response
offerId: "63352c1c0eed4ab9a640dafee08eff54"
namespace: "6a6d54e5b4ef4fb0b3dad1d02a320376"
validations: {
"conflictingOffers": [],
"missingPrerequisites": [],
"fullyOwnedOffers": [],
"possiblePartialUpgradeOffers": [],
"unablePartiallyUpgradeOffers": []
}
[2023-01-20 11:09:52.598 +0000] INFO: Unpurchased free games
purchasableGames: [
"Epistory - Typing Chronicles"
]
[2023-01-20 11:09:52.608 +0000] INFO: Purchasing Epistory - Typing Chronicles
[2023-01-20 11:09:52.616 +0000] DEBUG: Logging in with puppeteer
[2023-01-20 11:09:52.616 +0000] DEBUG: Launching a new browser
[2023-01-20 11:09:52.901 +0000] DEBUG: Launching a new page
[2023-01-20 11:09:53.657 +0000] INFO: Loading purchase page
purchaseUrl: "https://www.epicgames.com/store/purchase?highlightColor=0078f2&offers=1-6a6d54e5b4ef4fb0b3dad1d02a320376-63352c1c0eed4ab9a640dafee08eff54&orderId&purchaseToken&showNavigation=true"
[2023-01-20 11:10:06.855 +0000] DEBUG: Waiting for order button or cookie dialog
[2023-01-20 11:10:06.900 +0000] DEBUG: Clicking placeOrderButton
[2023-01-20 11:10:07.066 +0000] DEBUG: Waiting for receipt, captcha, refund dialog, or error
[2023-01-20 11:12:07.440 +0000] WARN: waiting for function failed: timeout 120000ms exceeded
err: {
"type": "TimeoutError",
"message": "waiting for function failed: timeout 120000ms exceeded",
"stack":
TimeoutError: waiting for function failed: timeout 120000ms exceeded
at new WaitTask (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:938:28)
at DOMWorld.waitForFunction (/usr/app/node_modules/puppeteer/src/common/DOMWorld.ts:844:22)
at Frame.waitForFunction (/usr/app/node_modules/puppeteer/src/common/FrameManager.ts:1449:28)
at Page.waitForFunction (/usr/app/node_modules/puppeteer/src/common/Page.ts:3472:29)
at PuppetPurchase.waitForPurchaseEvent (/usr/app/src/puppet/purchase.ts:36:10)
at initPurchase (/usr/app/src/puppet/purchase.ts:96:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at PuppetPurchase.purchaseShort (/usr/app/src/puppet/purchase.ts:137:7)
at redeemAccount (/usr/app/src/index.ts:40:9)
at run (/usr/app/node_modules/p-queue/dist/index.js:163:29)
"name": "TimeoutError"
}
[2023-01-20 11:12:07.590 +0000] ERROR: Encountered an error during browser automation. Saved a screenshot and page HTML for debugging purposes.
errorImage: "config/error-2023-01-20T11-12-07.081Z.png"
errorHtml: "config/error-2023-01-20T11-12-07.081Z.html"
[2023-01-20 11:12:07.591 +0000] INFO: Asking a human for help...
[2023-01-20 11:12:07.602 +0000] INFO: Go to this URL and do something
url: "http://10.68.51.207:3030/?targetId=BA8A0BFDE73ADC08EFD098DE19F786D8"
Additionally, I noticed that there are two cookie dialogs. One in the main page frame and then another one in the white order window that pops up to complete the order. Another hint that may be helpful.
I think I have found the source of the problem. It must be the race condition in purchase.ts. I modified the code and run the two waitForSelector separately. First check for the cookie dialog, then check for the order button. It worked. I am posting the code (needs improvement) that worked for me. I may create a pull request once I tidy it up and verify the fix.
The two separate functions
private async waitForOrderButton(page: Page): Promise<{
button: ElementHandle<HTMLButtonElement> | null;
hasOrderButton: boolean;
}> {
this.L.debug('Waiting for order button');
return Promise.resolve(
page
.waitForSelector(`button.payment-btn:not([disabled])`, {timeout: 3000})
.then((button) => ({ button, hasOrderButton: true }))
.catch(e => ({button: null, hasOrderButton: false}))
);
}
private async waitForCookieButton(page: Page): Promise<{
button: ElementHandle<HTMLButtonElement> | null;
hasCookieDialog: boolean;
}> {
this.L.debug('Waiting for cookie dialog');
return Promise.resolve(
page
.waitForSelector(`button#onetrust-accept-btn-handler`, {timeout: 3000})
.then((button) => ({ button, hasCookieDialog: true }))
.catch(e => ({button: null, hasCookieDialog: false}))
);
}
The part where the functions are called
const initPurchase = async (): Promise<void> => {
this.L.info({ purchaseUrl }, 'Loading purchase page');
await page.goto(purchaseUrl, { waitUntil: 'networkidle0' });
await page.waitForNetworkIdle({ idleTime: 2000 });
let cookieResult = await this.waitForCookieButton(page);
if (cookieResult.hasCookieDialog) {
this.L.debug('Clicking cookieDialog');
if (cookieResult.button) {
await cookieResult.button.click({ delay: 100 });
}
}
let orderResult = await this.waitForOrderButton(page);
if (!orderResult.hasOrderButton || !orderResult.button) {
this.L.debug(orderResult)
throw new Error('Could not detect place order button');
}
this.L.debug('Clicking placeOrderButton');
await orderResult.button.click({ delay: 100 });
Each time the docker image loads a purchase page, it gets stuck there and ends up in TimeoutError. I increased the timeout and now it looks like it takes up forever. The same url as in the logs work in chromium:
**Got a notification with the message and html and it seems that it gets stuck here: