Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/miniflare-disable-pool-timeouts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"miniflare": patch
---

fix: disable undici Pool request timeouts for local dev

Miniflare's undici `Pool` instances were using the default `headersTimeout` and `bodyTimeout` of 300 seconds (5 minutes). Any request taking longer than that — streaming responses, large uploads, long-polling, or compute-heavy Workers — would be silently killed with a "request failed" error.

Setting both timeouts to `0` disables them entirely, which is the correct behaviour for a local development tool where there is no reason to enforce request timeouts.
4 changes: 4 additions & 0 deletions packages/miniflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2143,6 +2143,10 @@ export class Miniflare {
if (previousEntryURL?.toString() !== this.#runtimeEntryURL.toString()) {
this.#runtimeDispatcher = new Pool(this.#runtimeEntryURL, {
connect: { rejectUnauthorized: false },
// Disable timeouts for local dev — long-running responses (streaming,
// slow uploads, long-polling) should not be killed by undici defaults.
headersTimeout: 0,
bodyTimeout: 0,
});
Comment thread
petebacondarwin marked this conversation as resolved.
}
if (this.#proxyClient === undefined) {
Expand Down
4 changes: 4 additions & 0 deletions packages/miniflare/src/plugins/core/proxy/fetch-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ port.addEventListener("message", async (event) => {
dispatcherUrl = url;
dispatcher = new Pool(url, {
connect: { rejectUnauthorized: false },
// Disable timeouts for local dev — long-running responses (streaming,
// slow uploads, long-polling) should not be killed by undici defaults.
headersTimeout: 0,
bodyTimeout: 0,
});
}
headers["${CoreHeaders.OP_SYNC}"] = "true";
Expand Down
Loading