Skip to content

Unable to connect to remote CDP endpoint #170

@geraldoprivacyhawk

Description

@geraldoprivacyhawk

I am trying to use Stagehand with Brigh Data by using the URL with embedded credentials from Bright Data Browser API service and it is not working. I am sure that the URL is correct because if I do

const browser = await chromium.connectOverCDP(CDP);
const page    = await browser.newPage();
await page.goto('https://google.com', {timeout: 120_000});
console.log(await page.title());
await browser.close();

It works and logs Google

My Stagehand initialization looks like this

const stagehand = new Stagehand({
        env: 'LOCAL',
        modelName: 'some-model',
        modelClientOptions: {
          apiKey: aiApiKey,
        },
        verbose: 1,
        localBrowserLaunchOptions: {
          headless: true,
          cdpUrl: SBR_CDP,
        },
      });

And after I do

await stagehand.init();

I get something like

TypeError: Cannot read properties of undefined (reading 'page')
    at Stagehand3.createLivePageProxy (...\node_modules\@browserbasehq\stagehand\dist\index.js:22382:60)
    at get page [as page] (...\node_modules\@browserbasehq\stagehand\dist\index.js:22411:34)
    at Stagehand3.<anonymous> (...\node_modules\@browserbasehq\stagehand\dist\index.js:22570:20)
    at Generator.next (<anonymous>)
    at fulfilled (...\node_modules\@browserbasehq\stagehand\dist\index.js:66:24))

Is this feature of remote browser only expected to work with local browsers or should it be working also with remote ones?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions