e2b-dev / e2b-dev/e2b-cookbook
Sandbox.connect() missing E2b-Sandbox-Id and E2b-Sandbox-Port headers (breaks self-hosted routing)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 264
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 8
Description
Bug Description
Sandbox.connect() (via _cls_connect_sandbox) does not include E2b-Sandbox-Id and E2b-Sandbox-Port headers in the ConnectionConfig. This breaks self-hosted E2B instances where the client proxy uses these headers to route requests to the correct sandbox.
SDK Version
- e2b
2.21.1/ Python
Root Cause
_create correctly adds:
extra_sandbox_headers["E2b-Sandbox-Id"] = sandbox_id
extra_sandbox_headers["E2b-Sandbox-Port"] = str(ConnectionConfig.envd_port)
Error
e2b_connect.client.ConnectException: (invalid_argument, 'Invalid host\n')
Fix
In _cls_connect_sandbox (sync + async), add:
sandbox_headers["E2b-Sandbox-Id"] = sandbox_id
sandbox_headers["E2b-Sandbox-Port"] = str(ConnectionConfig.envd_port)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read _cls_connect_sandbox in its sync and async variants and compare them with _create, which already adds the sandbox routing headers. Confirm that both connection paths include the sandbox ID and envd port in ConnectionConfig, then verify self-hosted routing no longer produces the reported invalid-host error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100