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

[rebrowser-patches] acquireContextId failed (tryAgain = true, tryCount = 3), errorMessage: N/A #73

Open
rickgrade3 opened this issue Dec 12, 2024 · 2 comments

Comments

@rickgrade3
Copy link

rickgrade3 commented Dec 12, 2024

Hi I just try "rebrowser-puppeteer": "^23.10.3"
with below code

const puppeteer = require('rebrowser-puppeteer');
const browser = await puppeteer.launch({
      defaultViewport: null,
      headless: false,
      args: [
        
        `--disable-blink-features=AutomationControlled`,
      ],
    });
    const page = await browser.newPage()
    await page.goto("https://reserve.dlt.go.th/reserve/v2/?menu=resv_m&state=");
    const html = await page.evaluate(()=>document.body.innerHTML)

and it's encounter the error

    Error: [rebrowser-patches] acquireContextId failed (tryAgain = true, tryCount = 3), errorMessage: N/A
    at ExecutionContext.acquireContextId (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:500:23)
    at ExecutionContext.#evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:510:13)
    at ExecutionContext.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:285:16)
    at IsolatedWorld.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/src/cdp/IsolatedWorld.ts:218:7)
    at CdpFrame.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/src/api/Frame.ts:474:12)
    at CdpPage.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/src/api/Page.ts:2238:12)
    at Command.<anonymous> (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/src/cmd/test_puppet.ts:265:18)
    ```
@rickgrade3
Copy link
Author

this is the log after apply env REBROWSER_PATCHES_DEBUG

rebrowser-patches][acquireContextId] id = -1, name = undefined, fixMode = addBinding, tryCount = 1
[rebrowser-patches][getMainWorld] binding name = bport5chlis244u
[rebrowser-patches][getMainWorld] result: { contextId: undefined }
[rebrowser-patches][acquireContextId] failed, try again (tryCount = 1)
[rebrowser-patches][acquireContextId] id = -1, name = undefined, fixMode = addBinding, tryCount = 2
[rebrowser-patches][getMainWorld] binding name = c8ub7sod0mmgmp
[rebrowser-patches][getMainWorld] result: { contextId: undefined }
[rebrowser-patches][acquireContextId] failed, try again (tryCount = 2)
[rebrowser-patches][acquireContextId] id = -1, name = undefined, fixMode = addBinding, tryCount = 3
[rebrowser-patches][getMainWorld] binding name = dmbs8ad5u4u8k
[rebrowser-patches][getMainWorld] result: { contextId: undefined }
Error: [rebrowser-patches] acquireContextId failed (tryAgain = true, tryCount = 3), errorMessage: N/A
at ExecutionContext.acquireContextId (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:500:23)
at ExecutionContext.#evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:510:13)
at ExecutionContext.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:285:16)
at IsolatedWorld.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/src/cdp/IsolatedWorld.ts:218:7)
at CdpFrame.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/src/api/Frame.ts:474:12)
at CdpPage.evaluate (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/node_modules/puppeteer-core/src/api/Page.ts:2238:12)
at Command. (/Users/anupatinsuvanno/DocumentsLocal/project/tillitsdone/poc/poc_license_plate/license-plate-svc/src/cmd/test_puppet.ts:265:18)

@nwebson
Copy link
Contributor

nwebson commented Dec 12, 2024

https://reserve.dlt.go.th/reserve/v2/?menu=resv_m&state= - redirects to auth form, do you have this error on auth page? Or do you have a cookie with logged in user, and then it triggers the error?

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

2 participants