stagehand icon indicating copy to clipboard operation
stagehand copied to clipboard

Running stagehande first time with pnpm create browser-app gives me StagehandDefaultError

Open piyushchauhan opened this issue 9 months ago • 2 comments

Error

/Users/piyushchauhan/projects/personal/stagehand/iniTest/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_openai@4_2lhsw4ohb6pbikidycysjge4hy/node_modules/@browserbasehq/stagehand/dist/index.js:3174
        throw new StagehandDefaultError();
              ^

StagehandDefaultError: 
Hey! We're sorry you ran into an error. 
If you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack

    at _StagehandPage.<anonymous> (/Users/piyushchauhan/projects/personal/stagehand/iniTest/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_openai@4_2lhsw4ohb6pbikidycysjge4hy/node_modules/@browserbasehq/stagehand/dist/index.js:3174:15)
    at Generator.throw (<anonymous>)
    at rejected (/Users/piyushchauhan/projects/personal/stagehand/iniTest/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_openai@4_2lhsw4ohb6pbikidycysjge4hy/node_modules/@browserbasehq/stagehand/dist/index.js:70:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Node.js v23.7.0
 ELIFECYCLE  Command failed with exit code 1.

How did I reach this error?

pnpm create browser-app
(node:29567) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
.../1960a45f2c2-737f                     | +158 ++++++++++++++++
.../1960a45f2c2-737f                     | Progress: resolved 158, reused 42, downloaded 116, added 158, done
✔ Enter a name for your project iniTest
✔ Would you like to start with a quickstart example? Yes
✔ Select AI model (API key required) OpenAI GPT-4o mini
✔ Enter your OpenAI API key (https://platform.openai.com/api-keys)
✔ Are you using Cursor or Windsurf? Cursor
✔ Run locally or on Browserbase (60 minutes free)? Local
Creating new browser app...
Cloning template from the Browserbase Stagehand Scaffold: https://github.com/browserbase/stagehand-scaffold (branch: anirudh/update-2.0)
(node:29660) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
Wrote environment variables to /Users/piyushchauhan/projects/personal/stagehand/iniTest/.env. Existing environment variables were taken from your environment.
Formatting code with Prettier...

piyushchauhan avatar Apr 06 '25 09:04 piyushchauhan

I ran into the same issue when providing an invalid API key

dillonstreator avatar Apr 09 '25 14:04 dillonstreator

Yeah, have you validated that your API key for your LLM is a valid one? We should patch this error

kamath avatar Apr 09 '25 19:04 kamath