Bug e2b 2195 throws dynamic usage of require is not eng 4003#1323
Conversation
Load undici lazily through the existing dynamic import path so creating a sandbox does not hit Turbopack's dynamic require stub. Keep the Node HTTP/2 dispatcher setup for envd requests, including the capped REST client and uncapped RPC client.
Turbopack can bundle the literal import but rejects the shared dynamic import helper as too dynamic. Keep loading undici only on the Node envd path while letting Next resolve the module on the first request.
There was a problem hiding this comment.
An organization admin can view or raise the cap at claude.ai/admin-settings/claude-code. The cap resets at the start of the next billing period.
Once the cap resets or is raised, reopen this pull request to trigger a review.
🦋 Changeset detectedLatest commit: 17bb8bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR SummaryMedium Risk Overview Adds an optional Reviewed by Cursor Bugbot for commit 17bb8bf. Bugbot is set up for automated code reviews on this repo. Configure here. |
Package ArtifactsBuilt from 0c15917. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.19.6-bug-e2b-2195-throws-dynamic-usage-of-require-is-not-eng-4003.0.tgzCLI ( npm install ./e2b-cli-2.10.2-bug-e2b-2195-throws-dynamic-usage-of-require-is-not-eng-4003.0.tgzPython SDK ( pip install ./e2b-2.21.0+bug.e2b.2195.throws.dynamic.usage.of.require.is.not.eng.4003-py3-none-any.whl |
Mark the envd undici import for bundlers to leave unresolved until runtime. The Node path still loads undici on first envd request, while Vite and Rspack web builds no longer try to bundle undici and its Node-only dependencies.
Hide the undici import from bundler static analysis and fall back to global fetch if it cannot be loaded. This keeps the HTTP/2 dispatcher path in Node without requiring a tsconfig module change or pulling undici into browser bundles.
Return the final envd fetch implementation from the loader instead of carrying an optional dispatcher envelope through the call site. The fallback path now reads as plain global fetch, while the undici path keeps dispatcher injection local.
Fix the JS SDK envd HTTP/2 transport so it works in Next.js/Turbopack production builds.
The HTTP/2 path loaded
undicithrough a dynamic require, which Turbopack rewrites to a runtime stub that throws during envd requests. This changes envd to loadundicilazily at runtime through an import that bundlers cannot statically rewrite. Ifundicicannot be loaded, the SDK falls back to globalfetch, so Node keeps the HTTP/2 dispatcher path when available without pullingundiciinto browser bundles.tested node/next/browser