Make projectId optional for Browserbase sessions
Merged
SH
8mo ago+92+92+01234567890123456789-44-44-01234567890123456789
Summary
- Browserbase no longer requires a
projectId— only an API key - Stops Stagehand from throwing when
BROWSERBASE_PROJECT_IDis not set, while still passing it through when provided - Updates all call sites:
requireBrowserbaseCreds(),createBrowserbaseSession(),StagehandAPIClient, and shutdown supervisor
Changes
v3.ts—requireBrowserbaseCreds()only throws on missingapiKey, makesprojectIdoptional in return type; removed redundant guard that still checkedprojectIdlaunch/browserbase.ts—projectIdparameter made optional, conditionally included in create payloadapi.ts—projectIdoptional inStagehandAPIClient,x-bb-project-idheader only sent when setshutdown/supervisor.ts— cleanup no longer requiresprojectIdtypes/private/shutdown.ts—projectIdmade optional inShutdownSupervisorConfig
Test plan
- Init with
BROWSERBASE_API_KEYonly (noBROWSERBASE_PROJECT_ID) — succeeds, connects to Browserbase, page loads - Verified redundant guard at
v3.ts:889was blocking init — fixed - Init with both env vars set — should still work as before
- Verify session cleanup works without
projectId
🤖 Generated with Claude Code
Co-authored-by: Chris Read rcreadii@gmail.com