Skip to content

SandboxError: 401: Invalid API key #629

Open
@lukeweb3

Description

@lukeweb3

Describe the bug
I ran the e2b sandbox following the steps shown in the README, and it reported the error:
SandboxError: 401: Invalid API key, please visit https://e2b.dev/docs?reason=sdk-missing-api-key to get your API key.

To Reproduce
I followed the steps exactly as described in the README:

  1. Install the TypeScript SDK.
  2. Signed up at https://e2b.dev/.
  3. Created my API key at https://e2b.dev/dashboard?tab=keys, and I saw $100 in credits.
  4. Set E2B_API_KEY=<my_api_key> in the .env file and also exported it.
  5. Ran the JavaScript script as shown in the README, then encountered the error.

During this process, I tried printing E2B_API_KEY in JavaScript, and it output correctly.

Terminal commands & output

> npx tsx ./index.ts 
~/github.com/e2b-dev/test/node_modules/e2b/src/api/index.ts:21
  return new SandboxError(`${response.response.status}: ${message}`)
         ^


SandboxError: 401: Invalid API key, please visit https://e2b.dev/docs?reason=sdk-missing-api-key to get your API key.
    at handleApiError (~/github.com/e2b-dev/test/node_modules/e2b/src/api/index.ts:21:10)
    at Function.<anonymous> (~/github.com/e2b-dev/test/node_modules/e2b/src/sandbox/sandboxApi.ts:179:17)
    at Generator.next (<anonymous>)
    at fulfilled (~/github.com/e2b-dev/test/node_modules/e2b/dist/index.js:51:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Desktop :

  • OS: ubuntu 22.04
  • "@e2b/code-interpreter": "^1.0.4"
  • "typescript": "^5.8.2"

I wonder if there's anything wrong with these steps? Or is the service unavailable at this very moment?
Thanks

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions