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

Property 'executionContextId' of 'undefined' #133

Closed
Zvih opened this issue Aug 23, 2024 · 16 comments
Closed

Property 'executionContextId' of 'undefined' #133

Zvih opened this issue Aug 23, 2024 · 16 comments

Comments

@Zvih
Copy link

Zvih commented Aug 23, 2024

it seems, An error is triggered when the Cloudflare checkbox tries to be checked automatically for the second time
image

@zfcsoftware
Copy link
Owner

Can you add rebuild steps to the problem?

@Zvih
Copy link
Author

Zvih commented Aug 23, 2024

@zfcsoftware Setup as I provied here #132

Run browser, go to page.

Actually, nothing special, just open page with cloudflare checkbox and got error. But checkbox is checked so error does not interfere the lib

@bookedkeeper
Copy link

Got the same error. It wasn't caught by a try/catch and crashed the script. Here's a trace:

TypeError: Cannot destructure property 'executionContextId' of 'undefined' as it is undefined.
    at <anonymous> ([...]/node_modules/puppeteer-real-browser/lib/data/puppeteer-core/src/cdp/FrameManager.ts:544:9)
    at async Promise.all (index 0)
    at FrameManager.#createIsolatedWorld ([...]/node_modules/puppeteer-real-browser/lib/data/puppeteer-core/src/cdp/FrameManager.ts:531:5)
    at async Promise.all (index 4)
    at FrameManager.initialize ([...]/node_modules/puppeteer-real-browser/lib/data/puppeteer-core/src/cdp/FrameManager.ts:210:63)
Node.js v20.16.0

Thanks for looking into this

@zfcsoftware
Copy link
Owner

@zfcsoftware Setup as I provied here #132

Run browser, go to page.

Actually, nothing special, just open page with cloudflare checkbox and got error. But checkbox is checked so error does not interfere the lib

Got the same error. It wasn't caught by a try/catch and crashed the script. Here's a trace:

TypeError: Cannot destructure property 'executionContextId' of 'undefined' as it is undefined.
    at <anonymous> ([...]/node_modules/puppeteer-real-browser/lib/data/puppeteer-core/src/cdp/FrameManager.ts:544:9)
    at async Promise.all (index 0)
    at FrameManager.#createIsolatedWorld ([...]/node_modules/puppeteer-real-browser/lib/data/puppeteer-core/src/cdp/FrameManager.ts:531:5)
    at async Promise.all (index 4)
    at FrameManager.initialize ([...]/node_modules/puppeteer-real-browser/lib/data/puppeteer-core/src/cdp/FrameManager.ts:210:63)
Node.js v20.16.0

Thanks for looking into this

Can you give me a working code that I can test? The problem you posted has already been solved. The code there does not work because it is part of somewhere. I need a code that works and gives this error.

@zfcsoftware zfcsoftware added question Further information is requested and removed question Further information is requested labels Aug 24, 2024
@Zvih
Copy link
Author

Zvih commented Aug 25, 2024

@zfcsoftware Hardly possible to trace. It usually appears after logging in to the website with a Cloudflare checkbox and after navigating to several pages. Maybe other guy can provide more info

@zfcsoftware
Copy link
Owner

I am closing the issue as it cannot be reproduced. If you find a way to reproduce it, please let me know here. Thank you.

@roockisgreat
Copy link

roockisgreat commented Aug 28, 2024

I have the same issue. Try this code:

const {browser, page} = await connect({
        headless: "new",
        turnstile: true,
        disableXvfb: true, 
});
await page.setRequestInterception(true);
page.on('request', request => {
      if(request.isInterceptResolutionHandled()) return;
      request.continue();
});
page.on("framenavigated", async (frame) => {
      if(frame.url().includes("cloudflare")){
          await client.send("Target.detachFromTarget", {
              targetId: frame._id,
          });
      }
});  
await page.goto("https://keepa.com/#!product/1-B0C4VQXSMT");

If i don't use setRequestInterception, the error appears after quite a few iterations. This is the only way I've found to simulate the error quickly. I use Chrome/128.0.6613.85 and Node 18.15.0.

@Zvih
Copy link
Author

Zvih commented Aug 28, 2024

@zfcsoftware

@zfcsoftware zfcsoftware reopened this Aug 28, 2024
@zfcsoftware
Copy link
Owner

I have the same issue. Try this code:

const {browser, page} = await connect({
        headless: "new",
        turnstile: true,
        disableXvfb: true, 
});
await page.setRequestInterception(true);
page.on('request', request => {
      if(request.isInterceptResolutionHandled()) return;
      request.continue();
});
page.on("framenavigated", async (frame) => {
      if(frame.url().includes("cloudflare")){
          await client.send("Target.detachFromTarget", {
              targetId: frame._id,
          });
      }
});  
await page.goto("https://keepa.com/#!product/1-B0C4VQXSMT");

If i don't use setRequestInterception, the error appears after quite a few iterations. This is the only way I've found to simulate the error quickly. I use Chrome/128.0.6613.85 and Node 18.15.0.

@zfcsoftware

The library guarantees stable operation only when used with headless false. When using 'new' it can be detected and errors can occur. When I used false, I did not encounter an error in the code.

@Zvih
Copy link
Author

Zvih commented Aug 29, 2024 via email

@Zvih
Copy link
Author

Zvih commented Aug 31, 2024

@zfcsoftware Hi there,
Does lib started supporting both true/false value for "headless" param ?

@zfcsoftware
Copy link
Owner

The library is not guaranteed to work except false but it does support it.

@Zvih
Copy link
Author

Zvih commented Sep 1, 2024

@zfcsoftware Should I start a new topic about support for headless: true, or are there no plans to fix that issue?

@CarbonPool
Copy link

Re-updating the pptr patch solved my problem

@zfcsoftware
Copy link
Owner

Can you try again with the latest version?

@zfcsoftware
Copy link
Owner

#162 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants