-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Description
After yesterday's commit d6f6695, custom templates that update to Node.js 24 fail to start properly.
Problem
When building and pushing a custom template with Node.js 24, the sandbox fails to initialize with a WebSocket connection timeout error. The e2b SDK also reports that the port is not open when trying to call runCode
.
Error Logs
During build/push post-check:
[2025-08-21T21:32:11Z] Saved: yy4y1lm84j3v2mg13ck2/dd3e6425-9397-40c8-9340-91595108e2bc
[2025-08-21T21:32:16Z] ...
[2025-08-21T21:32:17Z] [start] [stderr]: Failed to initialize default context:
[2025-08-21T21:32:17Z] [start] [stderr]: ERROR: Traceback (most recent call last):
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 647, in __await_impl_timeout__
[2025-08-21T21:32:17Z] [start] [stderr]: return await self.__await_impl__()
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 654, in __await_impl__
[2025-08-21T21:32:17Z] [start] [stderr]: await protocol.handshake(
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 319, in handshake
[2025-08-21T21:32:17Z] [start] [stderr]: status_code, response_headers = await self.read_http_response()
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 139, in read_http_response
[2025-08-21T21:32:17Z] [start] [stderr]: status_code, reason, headers = await read_response(self.reader)
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/http.py", line 120, in read_response
[2025-08-21T21:32:17Z] [start] [stderr]: status_line = await read_line(stream)
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/http.py", line 194, in read_line
[2025-08-21T21:32:17Z] [start] [stderr]: line = await stream.readline()
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/usr/local/lib/python3.12/asyncio/streams.py", line 568, in readline
[2025-08-21T21:32:17Z] [start] [stderr]: line = await self.readuntil(sep)
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/usr/local/lib/python3.12/asyncio/streams.py", line 660, in readuntil
[2025-08-21T21:32:17Z] [start] [stderr]: await self._wait_for_data('readuntil')
[2025-08-21T21:32:17Z] [start] [stderr]: File "/usr/local/lib/python3.12/asyncio/streams.py", line 545, in _wait_for_data
[2025-08-21T21:32:17Z] [start] [stderr]: await self._waiter
[2025-08-21T21:32:17Z] [start] [stderr]: asyncio.exceptions.CancelledError
[2025-08-21T21:32:17Z] [start] [stderr]: The above exception was the direct cause of the following exception:
[2025-08-21T21:32:17Z] [start] [stderr]: Traceback (most recent call last):
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/starlette/routing.py", line 732, in lifespan
[2025-08-21T21:32:17Z] [start] [stderr]: async with self.lifespan_context(app) as maybe_state:
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
[2025-08-21T21:32:17Z] [start] [stderr]: return await anext(self.gen)
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/main.py", line 43, in lifespan
[2025-08-21T21:32:17Z] [start] [stderr]: javascript_context = await create_context(client, websockets, "javascript", "/home/user")
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/contexts.py", line 58, in create_context
[2025-08-21T21:32:17Z] [start] [stderr]: await ws.connect()
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/messaging.py", line 73, in connect
[2025-08-21T21:32:17Z] [start] [stderr]: self._ws = await connect(
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/root/.server/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 646, in __await_impl_timeout__
[2025-08-21T21:32:17Z] [start] [stderr]: async with asyncio_timeout(self.open_timeout):
[2025-08-21T21:32:17Z] [start] [stderr]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-21T21:32:17Z] [start] [stderr]: File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
[2025-08-21T21:32:17Z] [start] [stderr]: raise TimeoutError from exc_val
[2025-08-21T21:32:17Z] [start] [stderr]: TimeoutError
[2025-08-21T21:32:17Z] [start] [stderr]: ERROR: Application startup failed. Exiting.
[2025-08-21T21:32:19Z] Template is ready
[2025-08-21T21:32:20Z] Saving layer: y16qom9xiqzeed327ccr/003a3382-c2f5-4be3-9561-efab81670fa5
When calling e2b SDK runCode
:
❌ SandboxCommands.runClaudeCode failed: TimeoutError: {"sandboxId":"i5tkzt0h4esde0ccbopam","message":"The sandbox is running but port is not open","port":49999,"code":502}: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeoutMs' when starting the sandbox or calling '.setTimeout' on the sandbox with the desired timeout.
Reproduction Steps
- Create a custom Dockerfile based on
e2bdev/code-interpreter:latest
- Add Node.js 24 installation:
FROM e2bdev/code-interpreter:latest
# Install required packages including sudo
RUN apt-get update && apt-get install -y \
git \
sudo \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && \
apt-get install -y nodejs
- Build the template:
e2b template build -c "/root/.jupyter/start-up.sh"
- Push and try to run code via SDK
Expected Behavior
The sandbox should start successfully and accept WebSocket connections for code execution.
Actual Behavior
The sandbox fails to initialize with a WebSocket timeout error, and the port 49999 is not accessible.
Investigation
Through testing, I've identified that:
- The issue occurs specifically after updating to Node.js 24
- The same Dockerfile works without the Node.js 24 installation
- The problem appears related to the recent commit mentioned above
Environment
- Tested on both macOS and latest Ubuntu with identical results
- Using e2b CLI for template building
- e2b SDK for runtime execution
syog1nesyog1ne
Metadata
Metadata
Assignees
Labels
No labels