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.

Revisions

  1. anthonywu revised this gist Oct 23, 2025. No changes.
  2. anthonywu created this gist Oct 23, 2025.
    13 changes: 13 additions & 0 deletions build.dev.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    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);
    24 changes: 24 additions & 0 deletions bun run
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    $ 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
    9 changes: 9 additions & 0 deletions e2b.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # 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
    14 changes: 14 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    {
    "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"
    }
    }