e2b-dev / E2B

Secure open source cloud runtime for AI apps & AI agents
https://e2b.dev/docs
Apache License 2.0
7.02k stars 458 forks source link

Error creating a sandbox with the @rc version #427

Closed mwrshah closed 2 months ago

mwrshah commented 3 months ago

Describe the bug Trying to use e2b@rc I am unable to create a sandbox.

To Reproduce Steps to reproduce the behavior:

  1. Run the following code const sbx = await Sandbox.create(template, { metadata: { userID, template, }, timeoutMs: sandboxTimeout, })

  2. Error pops up about keepAlive.

Expected behavior

  1. Successful sandbox creation?

Trace TypeError: keepalive at extractBody (node:internal/deps/undici/undici:4134:17) at new Request (node:internal/deps/undici/undici:5070:48) at doOriginalFetch (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:422:29) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:589:24) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:134:36) at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js:58:24) at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54) at NoopTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js:73:31) at ProxyTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js:38:24) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:116:103) at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js:58:24) at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54) at NextTracerImpl.trace (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:116:28) at patched (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:233:41) at coreFetch (webpack-internal:///(action-browser)/./node_modules/openapi-fetch/dist/index.js:122:26) at Object.POST (webpack-internal:///(action-browser)/./node_modules/openapi-fetch/dist/index.js:177:14) at _Sandbox.eval (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:2764:36) at Generator.next () at eval (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:61:61) at new Promise () at async (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:45:10) at _Sandbox.createSandbox (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:2761:12) at _Sandbox.eval (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:2817:72) at Generator.next () at eval (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:61:61) at new Promise () at async (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:45:10) at _Sandbox.create (webpack-internal:///(action-browser)/./node_modules/e2b/dist/index.mjs:2813:12) at createOrConnectNextjs (webpack-internal:///(action-browser)/./lib/sandbox.ts:60:72) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async writeToPage (webpack-internal:///(action-browser)/./lib/sandbox.ts:91:17) at async /Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:418 at async rw (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7978) at async r4 (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:41:1251) at async doRender (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:1438:30) at async cacheEntry.responseCache.get.routeKind (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:1587:40) at async DevServer.renderToResponseWithComponentsImpl (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:1507:28) at async DevServer.renderPageComponent (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:1931:24) at async DevServer.renderToResponseImpl (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:1969:32) at async DevServer.pipeImpl (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:920:25) at async NextNodeServer.handleCatchallRenderRequest (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/next-server.js:272:17) at async DevServer.handleRequestImpl (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/base-server.js:816:17) at async /Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/dev/next-dev-server.js:339:20 at async Span.traceAsyncFn (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/trace/trace.js:154:20) at async DevServer.handleRequest (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/dev/next-dev-server.js:336:24) at async invokeRender (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/lib/router-server.js:174:21) at async handleRequest (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/lib/router-server.js:353:24) at async requestHandlerImpl (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/lib/router-server.js:377:13) at async Server.requestListener (/Users/munawarali/Documents/coded_programs/2wincoder/twincode/node_modules/next/dist/server/lib/start-server.js:141:13) ⨯ TypeError: keepalive Terminal commands & output Commands you used to start the app and the terminal output.

Env:

ValentaTomas commented 3 months ago

There seems to be some regression when E2B is used with the newest Next versions. Can you try downgrading Next? In the meantime, we will be looking into fixing properly.

mwrshah commented 2 months ago

Thanks for the suggestion. So far, I've tries downgraded all the way to 14.1 but no-go.

ValentaTomas commented 2 months ago

@mwrshah Can you try upgrading E2B SDK to https://www.npmjs.com/package/e2b/v/0.16.2-beta.44?

mwrshah commented 2 months ago

@ValentaTomas Thanks for the more verbose logging. It helped me to figure out the issue was that somehow system Timezone is being compared to a Z / UTC value. On setting terminal timezone to export TZ=UTC this was resolved.

mwrshah commented 2 months ago

I take that back - this is still a problem. Consistently facing an issue with creates and connects both with the beta version - works reliably with CLI. Could it be that I am doing

const sbx = await Sandbox.connect(sandboxId) await sbx.setTimeout(600_000)

Instead of await Sandbox.setTimeout(sbx.sandboxId, 600_000)

Having more success with the second.

mwrshah commented 2 months ago

Now fixed. Might have been an infrastructure issue as discussed with the team.