Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic - Can't claim 18+ game (reaching timeout) #120

Closed
maxp1110 opened this issue Apr 6, 2023 · 16 comments
Closed

Epic - Can't claim 18+ game (reaching timeout) #120

maxp1110 opened this issue Apr 6, 2023 · 16 comments
Labels
bug Something isn't working store: epic-games

Comments

@maxp1110
Copy link

maxp1110 commented Apr 6, 2023

Hello,
I am currently running into a problem with this weeks free giveaway at Epic (Dying Light Enhanced Edition). The script seems to be not able to claim the game and runs into an timeout.

Free games: [
  'https://store.epicgames.com/en-US/p/dying-light',
  'https://store.epicgames.com/en-US/p/shapez-0929c9'
]
  This game contains mature content recommended only for ages 18+
Current free game: Dying Light Enhanced Edition
  Not in library yet! Click GET.
locator.click: Timeout 60000ms exceeded.
=========================== logs ===========================
waiting for frameLocator('#webPurchaseContainer iframe').locator('button:has-text("Place Order"):not(:has(.payment-loading--loading))')
============================================================
    at file:///fgc/epic-games.js:180:99 {
  name: 'TimeoutError'
}

Is there a way for me to fix this issue?

Thanks!

@OJ7
Copy link
Contributor

OJ7 commented Apr 6, 2023

Receiving the same error with slightly different logs:

Free games: [
  'https://store.epicgames.com/en-US/p/dying-light',
  'https://store.epicgames.com/en-US/p/shapez-0929c9'
]
  This game contains mature content recommended only for ages 18+
page.click: Timeout 60000ms exceeded.
=========================== logs ===========================
waiting for locator('button:has-text("Continue")')
  locator resolved to <button class="css-1a6we1t">…</button>
attempting click action
  waiting for element to be visible, enabled and stable
  element is visible, enabled and stable
  scrolling into view if needed
  done scrolling
  performing click action
============================================================
    at file:///fgc/epic-games.js:120:18 {
  name: 'TimeoutError'
}

In my case, when clicking the "GET" button, the popup shows a gray screen with a spinner, but eventually dismisses and the "GET" button is clickable again. I was not able to redeem it using VNC by manually clicking either (same issue).

I haven't tried manually redeeming it in my regular browser yet in case a new version needs to be tested for this.

@xBlackPoison357x
Copy link

image
Same error

@EthanC
Copy link

EthanC commented Apr 7, 2023

I have this error too. Interestingly enough, it eventually succeeded in claiming the title without any modifications.

Logs

Free games: [
  'https://store.epicgames.com/en-US/p/dying-light',
  'https://store.epicgames.com/en-US/p/shapez-0929c9'
]
  This game contains mature content recommended only for ages 18+
page.click: Timeout 60000ms exceeded.
=========================== logs ===========================
waiting for locator('button:has-text("Continue")')
  locator resolved to <button class="css-1a6we1t">…</button>
attempting click action
  waiting for element to be visible, enabled and stable
  element is visible, enabled and stable
  scrolling into view if needed
  done scrolling
  performing click action
============================================================
    at file:///fgc/epic-games.js:120:18 {
  name: 'TimeoutError'
}

@vogler vogler added the bug Something isn't working label Apr 7, 2023
@vogler
Copy link
Owner

vogler commented Apr 7, 2023

Can't test it, since the game is not available for german accounts:
image

There's already code that should deal with this message:

// click Continue if 'This game contains mature content recommended only for ages 18+'
if (await page.locator('button:has-text("Continue")').count() > 0) {
console.log(' This game contains mature content recommended only for ages 18+');
await page.click('button:has-text("Continue")');
}

Observations:

  1. Since the code succeeded unmodified for @EthanC after some time, it must be some timing issue.
  2. All of your logs show the This game contains mature content ... message, so there's no timing issue detecting that there's a Continue button to click.
  3. For @maxp1110, it did successfully click Continue but timed out later; for @OJ7, @xBlackPoison357x, @EthanC it timed out clicking this Continue button.
  4. All of Playwright's preconditions for click seem to be met: element is visible, enabled and stable. According to the docs, it could only be the last step Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.

There's a couple of things we can try:

  1. Maybe it's the same as for some past issue where the correct event handler has not yet been attached, which was fixed by adding a click delay.
  2. Maybe there's some issue with loading a resource after, which could be fixed by noWaitAfter.
  3. If all else fails, we could add some delays around actions and see if that helps.

vogler added a commit that referenced this issue Apr 7, 2023
@EthanC
Copy link

EthanC commented Apr 7, 2023

Additional context - the script continued to sometimes TimeoutError after successfully claiming the game.

image

I've now updated to the latest Docker image following the above commit. 4/10 attempts I received a new error...

Free games: [
  'https://store.epicgames.com/en-US/p/dying-light',
  'https://store.epicgames.com/en-US/p/shapez-0929c9'
]
  This game contains mature content recommended only for ages 18+
Current free game: Dying Light Enhanced Edition
  Already in library! Nothing to claim.
Current free game: shapez
  Already in library! Nothing to claim.
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^
ProtocolError: Target closed
    at /fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:189:16
    at new Promise (<anonymous>)
    at FFSession.send (/fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:185:12)
    at RawMouseImpl.move (/fgc/node_modules/playwright-core/lib/server/firefox/ffInput.js:91:24)
    at Mouse.move (/fgc/node_modules/playwright-core/lib/server/input.js:153:23)
    at Mouse.click (/fgc/node_modules/playwright-core/lib/server/input.js:180:12)
    at /fgc/node_modules/playwright-core/lib/server/dom.js:468:109
    at /fgc/node_modules/playwright-core/lib/server/dom.js:430:13
    at FrameManager.waitForSignalsCreatedBy (/fgc/node_modules/playwright-core/lib/server/frames.js:114:26)
    at ElementHandle._performPointerAction (/fgc/node_modules/playwright-core/lib/server/dom.js:424:57) {
  sessionClosed: true
}
Node.js v19.8.1

All other attempts were completed successfully. I'll report back if I see the TimeoutError again.

vogler added a commit that referenced this issue Apr 7, 2023
@vogler
Copy link
Owner

vogler commented Apr 7, 2023

@EthanC Ok, so the click delay seems to have solved the Timeout for clicking on Continue. The Target closed error means that the browser closed while there were still promises to be resolved. In case of the already claimed game, this should be the click on Continue, which is strange since it has an await which should block. Maybe some internal Playwright issue.
I added a delay after the click as well, which hopefully is enough to avoid this issue.

@maxp1110
Copy link
Author

maxp1110 commented Apr 7, 2023

Hi @vogler: Thanks for the updated version! After the 1st attempt still showed the same error message, the 2nd try gave probably the reason why it did not work:

Current free game: Dying Light Enhanced Edition
  Not in library yet! Click GET.
  This product is unavailable in your region!

Im also from Germany, however my epic account is set to US and there seems to be IP-Geoblock when trying to purchase it, even when trying to do so manually
image

edit: I know this feature might probably not be of interest for the most folks, but could VPN-support be added to the docker?

@OJ7
Copy link
Contributor

OJ7 commented Apr 7, 2023

I'm reading on a forum that others had issues yesterday redeeming it too while manually trying to claim the game. I just ran the script again now and it worked the first time. Looks like this may have been a temporary issue with Epic's website.

@vogler
Copy link
Owner

vogler commented Apr 8, 2023

edit: I know this feature might probably not be of interest for the most folks, but could VPN-support be added to the docker?

I opened an issue for it.

@xBlackPoison357x
Copy link

@EthanC Ok, so the click delay seems to have solved the Timeout for clicking on Continue. The Target closed error means that the browser closed while there were still promises to be resolved. In case of the already claimed game, this should be the click on Continue, which is strange since it has an await which should block. Maybe some internal Playwright issue. I added a delay after the click as well, which hopefully is enough to avoid this issue.

Just got the target closed error today.
image

@vogler
Copy link
Owner

vogler commented Apr 14, 2023

@xBlackPoison357x did you also get a notification for it?

It's a bit annoying that the trace doesn't contain any useful information, but it should be the click on Continue which somehow hangs around after the promise already resolved.

I assume claiming 18+ games should now work for everyone without a timeout. Just this Target closed exception left which could also be ignored.

@vogler
Copy link
Owner

vogler commented Apr 20, 2023

Just tested Mordhau (18+):

  1. Game was claimed successfully, but got Timeout waiting for locator('text=Thank you for buying') to be visible
  2. Got Target closed exception sometimes when running afterwards.

Regarding 2., the problem is between clicking on the Continue button:

await page.click('button:has-text("Continue")', { delay: 111 });

and closing the browser context at the end:
await context.close();

When commenting either out, I did not get Target closed.
However, without the click, the message stays there and the title of the game is not detected correctly, and without the close, it just waits around at the end.
Same effect when I removed the , { delay: 111 } from the click. Adding noWaitAfter had no effect.
So it seems like Playwright creates another promise with delay which then hangs around waiting.
Catching the exception to ignore it did not work - neither adding .catch(_ => { }) for the click, nor

try {
  await context.close();
} catch (error) {
  console.error(error.message, error);
}

node --stack-trace-limit=1000 epic-games.js also only showed internal Playwright calls in the trace:

  This game contains mature content recommended only for ages 18+
  clicked continue
  waited
Current free game: MORDHAU
  Already in library! Nothing to claim.
Current free game: Second Extinction™
  Already in library! Nothing to claim.
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ProtocolError: Target closed
    at /fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:189:16
    at new Promise (<anonymous>)
    at FFSession.send (/fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:185:12)
    at RawMouseImpl.move (/fgc/node_modules/playwright-core/lib/server/firefox/ffInput.js:91:24)
    at Mouse.move (/fgc/node_modules/playwright-core/lib/server/input.js:153:23)
    at Mouse.click (/fgc/node_modules/playwright-core/lib/server/input.js:180:12)
    at /fgc/node_modules/playwright-core/lib/server/dom.js:468:109
    at /fgc/node_modules/playwright-core/lib/server/dom.js:430:13
    at FrameManager.waitForSignalsCreatedBy (/fgc/node_modules/playwright-core/lib/server/frames.js:114:26)
    at ElementHandle._performPointerAction (/fgc/node_modules/playwright-core/lib/server/dom.js:424:57)
    at async ElementHandle._retryPointerAction (/fgc/node_modules/playwright-core/lib/server/dom.js:342:22)
    at async /fgc/node_modules/playwright-core/lib/server/frames.js:992:24
    at async Frame.retryWithProgressAndTimeouts (/fgc/node_modules/playwright-core/lib/server/frames.js:914:24)
    at async /fgc/node_modules/playwright-core/lib/server/frames.js:1012:29
    at async ProgressController.run (/fgc/node_modules/playwright-core/lib/server/progress.js:92:22)
    at async FrameDispatcher.click (/fgc/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js:149:12)
    at async DispatcherConnection.dispatch (/fgc/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js:319:22) {
  sessionClosed: true
}

Node.js v19.2.0

@ChekeredList71
Copy link

ChekeredList71 commented Apr 29, 2023

For me it fails if an 18+ game is available, but I'm not sure about this, because the first game it tries to claim isn't 18+.
Could it be, that it is the same issue, or should it go into a different issue? Thanks.

2023-04-29 11:48:32.500 started checking epic-games
Signed in as ChekeredList71
Free games: [
  'https://store.epicgames.com/en-US/p/breathedge',
  'https://store.epicgames.com/en-US/p/poker-club-6e18ee'
]
Current free game: Breathedge
  Not in library yet! Click GET.
locator.click: Timeout 60000ms exceeded.
=========================== logs ===========================
waiting for frameLocator('#webPurchaseContainer iframe').locator('button:has-text("Place Order"):not(:has(.payment-loading--loading))')
============================================================
    at file:///fgc/epic-games.js:184:99 {
  name: 'TimeoutError'
}
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ProtocolError: Target closed
    at /fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:189:16
    at new Promise (<anonymous>)
    at FFSession.send (/fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:185:12)
    at RawMouseImpl.move (/fgc/node_modules/playwright-core/lib/server/firefox/ffInput.js:91:24)
    at Mouse.move (/fgc/node_modules/playwright-core/lib/server/input.js:153:23)
    at Mouse.click (/fgc/node_modules/playwright-core/lib/server/input.js:180:12)
    at /fgc/node_modules/playwright-core/lib/server/dom.js:468:109
    at /fgc/node_modules/playwright-core/lib/server/dom.js:430:13
    at FrameManager.waitForSignalsCreatedBy (/fgc/node_modules/playwright-core/lib/server/frames.js:114:26)
    at ElementHandle._performPointerAction (/fgc/node_modules/playwright-core/lib/server/dom.js:424:57) {
  sessionClosed: true
}

Node.js v19.9.0

Neither of the games were claimed.

OS: Linux Mint 21.1

@vogler
Copy link
Owner

vogler commented Apr 29, 2023

@ChekeredList71 No, this is something else, neither are 18+ (at least for me in DE).
Check via VNC what's up and open a new issue with the details if the problem persists.

@xBlackPoison357x
Copy link

xBlackPoison357x commented May 20, 2023

image

Just got a Target closed. I see where you say this can probably be ignored, just figured I'd report it regardless.

@vogler
Copy link
Owner

vogler commented Jul 13, 2023

Closing this since timeout is fixed. Tracking Target closed exception in #170.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working store: epic-games
Projects
None yet
Development

No branches or pull requests

6 participants