fix(vercel-sandbox): disable headers timeout on default agent#172
Open
umairnadeem wants to merge 1 commit intovercel:mainfrom
Open
fix(vercel-sandbox): disable headers timeout on default agent#172umairnadeem wants to merge 1 commit intovercel:mainfrom
umairnadeem wants to merge 1 commit intovercel:mainfrom
Conversation
`DEFAULT_AGENT` already disables `bodyTimeout` to support long-running streams, but undici's `headersTimeout` was left at its 5-min default. That cuts off `cmd.wait()`'s long-poll request when a sandbox command runs longer than 5 minutes, even when the sandbox itself has a longer timeout. Set `headersTimeout: 0` to match the existing intent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
@umairnadeem is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
cc @QuiiBz |
umairnadeem
added a commit
to openslop/openslop
that referenced
this pull request
May 1, 2026
`@vercel/sandbox`'s default undici Agent disables `bodyTimeout` but leaves `headersTimeout` at undici's 5-min default, causing `cmd.wait()`'s long-poll to abort after 5 min even when the sandbox itself has a longer timeout. That was capping `createSandbox`'s `timeoutInMilliseconds: 15 * 60 * 1000` at 5 min and breaking long `pnpm install` steps inside `create-snapshot.ts`. Patches both the ESM and CJS dist files via patch-package. Reapplied on postinstall, including in the Vercel build container. Locked to the version in package-lock.json (1.10.0); patch will be removed once vercel/sandbox#172 ships in a release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
QuiiBz
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DEFAULT_AGENTinbase-client.tsdisablesbodyTimeoutbut leaves undici'sheadersTimeoutat its 5-min default:That breaks
cmd.wait(). It issues a single GET to/v1/sandboxes/{id}/cmd/{cmdId}?wait=true— the API holds the connection open and only sends response headers once the command finishes. If the underlying command takes longer than 5 min, undici aborts the request before headers arrive and throwsTimeoutError(code: 23), even though the sandbox itself is still happily running.Repro
Hit this via
@remotion/vercel'screateSandbox. SetSandbox.create({ timeout: 15 * 60 * 1000 }). Sandbox lived its full 15 min per the Vercel dashboard. Script died at exactly 5 min withTimeoutError: The operation timed out.mid-pnpm install. So thetimeoutoption is effectively capped at 5 min for any command (cold pnpm install, browser download, etc.) that runs longer.Fix
Also set
headersTimeout: 0onDEFAULT_AGENT. Matches the existing intent — the comment onbodyTimeout: 0says "disable body timeout to allow long logs streaming", and the long-poll endpoint is just as much a long-running pattern as streaming logs.No public API change.