Skip to content

Set fetch timeout to 5 minutes - #6217

Merged
Jarred-Sumner merged 2 commits into
mainfrom
jarred/increase-timeouts
Oct 3, 2023
Merged

Jarred-Sumner merged 2 commits into
mainfrom
jarred/increase-timeouts

Conversation

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

What does this PR do?

  • Set the default timeout for fetch to 5 minutes instead of 60 seconds

How did you verify your code works?

Existing tests

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator Author

Fixes #4799
Fixes #5930

@remorses

remorses commented Oct 1, 2023

Copy link
Copy Markdown
Contributor

Why do you need a default timeout?

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator Author

Why do you need a default timeout?

Processes generally shouldn't hang forever. The timeout is not an absolute number, it is since the last time a message was received. You can disable the timeout for fetch with timeout: false

@Jarred-Sumner
Jarred-Sumner merged commit b444c0b into main Oct 3, 2023
@Jarred-Sumner
Jarred-Sumner deleted the jarred/increase-timeouts branch October 3, 2023 01:02
@empz

empz commented Oct 10, 2024

Copy link
Copy Markdown

Why do you need a default timeout?

Processes generally shouldn't hang forever. The timeout is not an absolute number, it is since the last time a message was received. You can disable the timeout for fetch with timeout: false

Sorry to post here, but where do you set this?

Bun.fetch(url, {
  method: "POST",
  body: someBody,
  timeout: false // Typescript doesn't like
}

image

Is it a types problem and the argument actually works??

umairnadeem added a commit to openslop/openslop that referenced this pull request May 1, 2026
Bun's fetch has a default 5-min idle timeout (oven-sh/bun#6217) that fires
between received chunks of data. The Vercel Sandbox `cmd.wait()` long-poll
endpoint sends no bytes until the underlying command finishes, so Bun
interprets that as 5 min of idle and aborts the request — even though the
sandbox itself is healthy and has a 15-min lifetime.

Bun's fetch also ignores the undici `dispatcher` option, which is why the
@vercel/sandbox patch (disabling undici's headersTimeout) was inert under
Bun. Switching the runner to node makes globalThis.fetch undici-backed,
which respects the patched dispatcher.

Renames create-snapshot.ts to .mts to force ESM mode (required by
@remotion/vercel which only ships ESM exports). Adds allowImportingTsExtensions
since native node TS stripping needs explicit `.ts` extensions on relative
imports under ESM resolution.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants