Skip to content

Instantly share code, notes, and snippets.

@anthonywu
Created October 23, 2025 23:26
Show Gist options
  • Select an option

  • Save anthonywu/5c4be5fe14c8fec76f40d99c0da68a8d to your computer and use it in GitHub Desktop.

Select an option

Save anthonywu/5c4be5fe14c8fec76f40d99c0da68a8d to your computer and use it in GitHub Desktop.
import { Template, defaultBuildLogger } from "e2b";
import { template } from "./template";
async function main() {
await Template.build(template, {
alias: "ploy-sandbox-1-dev",
cpuCount: 2,
memoryMB: 4096,
onBuildLogs: defaultBuildLogger(),
});
}
main().catch(console.error);
$ dotenvx run -f .env.local -- tsx ./test_1.ts
[[email protected]] 📡 radar: off
[[email protected]] injecting env (3) from .env.local
{
exitCode: 0,
error: undefined,
stdout: 'Filesystem Size Used Avail Use% Mounted on\n' +
'/dev/root 11G 465M 10G 5% /\n',
stderr: ''
}
/Users/anthonywu/workspace/makeme-dev/src/e2b-sandbox-1/node_modules/@e2b/code-interpreter/src/messaging.ts:11
return new TimeoutError(
^
TimeoutError: {"sandboxId":"i0h7jnvca25qcfgog9uv8","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.
at extractError (/Users/anthonywu/workspace/makeme-dev/src/e2b-sandbox-1/node_modules/@e2b/code-interpreter/src/messaging.ts:11:14)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Sandbox.runCode (/Users/anthonywu/workspace/makeme-dev/src/e2b-sandbox-1/node_modules/@e2b/code-interpreter/src/sandbox.ts:244:21)
at async <anonymous> (/Users/anthonywu/workspace/makeme-dev/src/e2b-sandbox-1/test_1.ts:13:16)
Node.js v22.15.0
Command failed with exit code 1: /Users/anthonywu/workspace/makeme-dev/src/e2b-sandbox-1/node_modules/.bin/tsx ./test_1.ts
error: script "test-1" exited with code 1
# You can use most Debian-based base images
FROM oven/bun:1.3.1-debian
# prefix in e.g. /opt/bun/install/global/node_modules/$package/dist/index.js
# we cannot rely on /root/.bun default which is overwritten in live e2b sandbox
ENV BUN_INSTALL=/opt/bun
RUN bun install -g [email protected] && \
readlink $(which create-next-app) | grep /opt/bun
{
"type": "module",
"scripts": {
"test-1": "dotenvx run -f .env.local -- tsx ./test_1.ts",
"build-dev": "dotenvx run -f .env.local -- tsx build.dev.ts",
"build-prod": "dotenvx run -f .env.local -- tsx build.prod.ts"
},
"dependencies": {
"@e2b/code-interpreter": "^2.1.0"
},
"devDependencies": {
"tsx": "^4.20.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment