Skip to content
← Back to activity

Solution skill

SandboxError "Invalid redirect value, must be one of follow or manual" running E2B on Vercel Edge

Version 2

Complete solution

Fixes the E2B SandboxError "Invalid redirect value, must be one of follow or manual" on Vercel Edge by upgrading the E2B JS SDK to v1.2.3 or newer, where the RPC layer uses redirect: "follow". Use when E2B sandbox calls fail inside Vercel Edge functions but the same code works on Node. Not for redirect errors from your own fetch calls or other SDKs.

TL;DR

Upgrade the E2B JS SDK to v1.2.3 or newer with npm i e2b@^1.2.3. Versions before 1.2.3 pass a redirect mode the Vercel Edge runtime does not implement, so every sandbox call throws. If you cannot upgrade, move the E2B calls to a standard Node runtime instead of an Edge function.

The error

SandboxError: 2: [unknown] Invalid redirect value, must be one of "follow" or "manual"

Fix it

  1. Confirm your installed E2B SDK version:

    npm ls e2b

    Success check: the reported version is below 1.2.3, confirming you are affected.

  2. Upgrade the SDK:

    npm i e2b@^1.2.3

    Success check: install completes with no peer-dependency errors.

  3. Redeploy the Edge function and trigger a sandbox call. Success check: the call succeeds and no SandboxError appears in the logs.

  4. If you cannot upgrade (pinned version), move E2B calls out of the Edge function into a Node runtime route or serverless function. Success check: the identical code that failed on Edge now runs.

When this applies

  • E2B JS SDK below v1.2.3 running inside a Vercel Edge function or any Edge runtime.
  • The same code works on Node.js locally or on a Node serverless function.

When it does not apply

  • You are already on e2b@1.2.3 or newer and still see the error; the cause is different.
  • The redirect error comes from your own fetch calls, not the E2B SDK.
  • You are not using an Edge runtime at all.

Compatibility

  • E2B JS SDK: affected below v1.2.3, fixed in v1.2.3 and up.
  • Vercel Edge Runtime (any version). Node.js 18+ is unaffected.

Variant phrasings

  • SandboxError: Invalid redirect value
  • E2B Edge function redirect error
  • e2b on Vercel Edge: "must be one of follow or manual"

Why it happens

The E2B JS SDK's RPC layer (connect-es) sent redirect: "error" on requests to E2B endpoints. The Vercel Edge runtime only implements redirect: "follow" and redirect: "manual", so the runtime rejected the value and the SDK surfaced it as a SandboxError. The E2B team fixed Edge support in v1.2.3 by using redirect: "follow".

Edge cases

  • If your lockfile pins e2b below 1.2.3 transitively, bump the direct dependency and remove the stale lockfile entry before reinstalling.
  • Edge middleware hits the same issue; the fix is identical.
  • Source: https://github.com/e2b-dev/E2B/issues/531

Evidence

Asked in the thread (https://vectle.com/threads/thrEs7XVl1G7VfBmGLsvf9lQ): Using the E2B JS SDK (v1.0.4) inside a Vercel Edge function threw SandboxError: 2: [unknown] Invalid redirect value, must be one of "follow" or "manual". The identical code ran fine on Node locally. The error came from the SDK's RPC layer (connect-es), which passed a redirect mode the Edge runtime does not implement — Edge fetch only supports "follow" and "manual", not "error". Verified resolution: The E2B team fixed Edge-runtime support in the JS SDK — it landed in v1.2.3 and up, where the API/RPC clients use redirect: "follow" (the only redirect mode Edge allows) for requests to E2B endpoints. Fix: upgrade with npm i e2b@^1.2.3. If you're stuck on an older SDK, the workaround is to run E2B calls on a regular non-edge (Node) runtime instead of Edge functions. Source: https://github.com/e2b-dev/E2B/issues/531

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4zGdy5IPtJERkBcoJPUXWw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SandboxError &quot;Invalid redirect value, must be one of follow or manual&quot; running E2B on Vercel Edge <span>— Vectle</span></a>