Skip to content

Advance configuration return undefined #1237

@Bikiin

Description

@Bikiin

Before submitting an issue, please:

Environment Information

Please provide the following information to help us reproduce and resolve your issue:

Stagehand:

  • Language/SDK: [TypeScript, Python, MCP…]
  • Stagehand version: [e.g., 3.0.1]

AI Provider:

  • Provider: N/A (not used in this repro)
  • Model: N/A

Issue Description

`stagehand.init()` resolves to `undefined` when using env "BROWSERBASE", even though the session starts successfully.
The Stagehand logs print `sessionUrl`, `debugUrl`, and `sessionId`, but the variable that awaits `init()` is `undefined`.

Steps to Reproduce

  1. Create a Stagehand instance with the example https://docs.stagehand.dev/v3/configuration/browser#advanced-configuration.
  2. Call const result = await stagehand.init();
  3. Log the value: console.log("result" ,result); → it prints undefined, while Stagehand logs show the session details.

Minimal Reproduction Code

// Your minimal reproduction code here
import { Stagehand } from '@browserbase/stagehand';

const stagehand = new Stagehand({
  // IMPORTANT: include your stagehand config
  env: 'BROWSERBASE',
  apiKey: 'REDACTED',
  projectId: 'REDACTED',
  browserbaseSessionCreateParams: {
    projectId: 'REDACTED',
    proxies: false,
    region: 'us-west-2',
    timeout: 3600,
    keepAlive: true,
    browserSettings: {
      advancedStealth: false,
      blockAds: true,
      solveCaptchas: true,
      recordSession: false,
      viewport: { width: 1920, height: 1080 },
    },
  },
  userMetadata: {
    userId: 'automation-user-123',
    environment: 'production',
  },
});

// Steps that reproduce the issue
(async () => {
  const config = await stagehand.init();
  console.log('CONFIG', config); // => undefined (unexpected)
})();

Error Messages / Log trace

[2025-11-05 22:18:43.008 +0000] INFO: Using Browserbase credentials
category: "init"
[2025-11-05 22:18:43.008 +0000] INFO: Starting browserbase session
category: "init"
[2025-11-05 22:18:43.009 +0000] INFO: Creating new browserbase session...
category: "init"

CONFIG undefined

[2025-11-05 22:18:48.999 +0000] INFO: Browserbase session started
category: "init"
sessionUrl: "https://www.browserbase.com/sessions/<redacted>"
debugUrl: "https://www.browserbase.com/devtools/inspector.html?wss=connect.browserbase.com/debug/<redacted>/devtools/page/<redacted>?debug=true"
sessionId: "9c3b72bc-a519-4aa6-b849-a364a0723684"


Screenshots / Videos

Image Image

Related Issues

Are there any related issues or PRs?

  • Related to: #[issue number]
  • Duplicate of: #[issue number]
  • Blocks: #[issue number]

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