Skip to content

Sandbox.connect() missing E2b-Sandbox-Id and E2b-Sandbox-Port headers (breaks self-hosted routing) #103

Description

@syedhabib39

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions