-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Bug Report: modelApiKey is required when using BROWSERBASE environment
Before submitting an issue, please:
- Check the documentation for relevant information
- Search existing issues to avoid duplicates
Environment Information
Stagehand:
- Language/SDK: TypeScript
- Stagehand version: [not specified]
AI Provider:
- Provider: Google
- Model: [not specified]
Issue Description
When using Stagehand with the BROWSERBASE environment setting, the application throws an error stating "modelApiKey is required" even though the necessary API keys are configured in environment variables. The error does not occur when switching to the LOCAL environment.
Error executing computer use agent: StagehandAPIError: modelApiKey is required
at StagehandAPIClient.<anonymous> (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:39869:15)
at Generator.next (<anonymous>)
at /Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:80:61
at new Promise (<anonymous>)
at __async (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:64:10)
at StagehandAPIClient.init (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:39857:12)
at _V3.<anonymous> (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:40802:81)
at Generator.next (<anonymous>)
at /Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:80:61
at new Promise (<anonymous>)
Steps to Reproduce
- Set up environment variables for BROWSERBASE_PROJECT_ID, BROWSERBASE_API_KEY, and GOOGLE_API_KEY
- Configure Stagehand with
env: "BROWSERBASE" - Run the application
- Observe the error about missing modelApiKey
Minimal Reproduction Code
// Minimal reproduction code
import { Stagehand } from '@browserbase/stagehand';
const stagehand = new Stagehand({
env: "BROWSERBASE",
// Other configuration options
});
// Code that triggers the error
await stagehand.init();Error Messages / Log trace
Error executing computer use agent: StagehandAPIError: modelApiKey is required
at StagehandAPIClient.<anonymous> (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:39869:15)
at Generator.next (<anonymous>)
at /Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:80:61
at new Promise (<anonymous>)
at __async (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:64:10)
at StagehandAPIClient.init (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:39857:12)
at _V3.<anonymous> (/Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:40802:81)
at Generator.next (<anonymous>)
at /Users/[USERNAME]/Documents/[PROJECT]/node_modules/@browserbasehq/stagehand/dist/index.js:80:61
at new Promise (<anonymous>)
[2025-11-17 14:40:19.186 +0800] INFO: Using Browserbase credentials
category: "init"
[2025-11-17 14:40:19.186 +0800] INFO: Starting browserbase session
category: "init"
Session closed successfully
Screenshots / Videos
N/A
Related Issues
Are there any related issues or PRs?
https://github.com/browserbase/stagehand/issues?q=modelApiKey%20is%20required
Additional Context
The error doesn't occur when switching to "LOCAL" instead of "BROWSERBASE" environment.
Environment variables configured:
- BROWSERBASE_PROJECT_ID
- BROWSERBASE_API_KEY
- GOOGLE_API_KEY
Metadata
Metadata
Assignees
Labels
No labels