[wrangler] Keep request-scoped proxy errors non-fatal - #15207
Open
exKAZUu wants to merge 5 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: 00bc2e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
workers-devprod
requested review from
a team and
emily-shen
and removed request for
a team
August 15, 2026 13:28
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
yashau
added a commit
to yashau/prick
that referenced
this pull request
Aug 19, 2026
The e2e job died mid-run and passed on a re-run. It was not flaky infrastructure and it was not the OOM killer: `wrangler dev` exits on a SINGLE failed proxied request, and reports it as `✘ [ERROR]` with an empty message. Wrangler forwards every request through its own ProxyWorker. When that inner fetch rejects, the ProxyWorker reports it to the ProxyController, `DevEnv.handleErrorEvent` finds no matching non-fatal case and re-emits it as a top-level `error`; the dev command is `await events.once(devEnv, "teardown")`, and Node's `events.once` rejects on `error`, so the command throws and the process exits 1. The cause crossed a Worker boundary, so it is a plain object rather than an Error, and `castErrorCause` wraps it in `new Error()` -- message "". Hence a fatal exit that names nothing. The rejection is `Network connection lost.`, raised when a client disconnects while its request body is still uploading. Playwright does that every time it closes a page with a form POST in flight. Confirmed by reduction: five aborted uploads against a bare Worker kill wrangler 4.121.0 with the exact CI signature, and survive it patched. So the failure was one browser-side race taking down the server for the rest of the suite -- seventy `ERR_CONNECTION_REFUSED` failures, three attempts each, none of them naming the event. Patch wrangler with upstream's own fix (cloudflare/workers-sdk#15207, issue #15203): report the failed request and keep serving. Two call sites, because wrangler bundles the ProxyController twice. Remove the patch when a release carries the fix -- a version bump that leaves it here fails the install rather than applying quietly. `patches/**` joins the js paths filter: a patched dependency is application behaviour, and editing it must run the suite that proves it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
yashau
added a commit
to yashau/prick
that referenced
this pull request
Aug 19, 2026
The e2e job died mid-run and passed on a re-run. It was not flaky infrastructure and it was not the OOM killer: `wrangler dev` exits on a SINGLE failed proxied request, and reports it as `✘ [ERROR]` with an empty message. Wrangler forwards every request through its own ProxyWorker. When that inner fetch rejects, the ProxyWorker reports it to the ProxyController, `DevEnv.handleErrorEvent` finds no matching non-fatal case and re-emits it as a top-level `error`; the dev command is `await events.once(devEnv, "teardown")`, and Node's `events.once` rejects on `error`, so the command throws and the process exits 1. The cause crossed a Worker boundary, so it is a plain object rather than an Error, and `castErrorCause` wraps it in `new Error()` -- message "". Hence a fatal exit that names nothing. The rejection is `Network connection lost.`, raised when a client disconnects while its request body is still uploading. Playwright does that every time it closes a page with a form POST in flight. Confirmed by reduction: five aborted uploads against a bare Worker kill wrangler 4.121.0 with the exact CI signature, and survive it patched. So the failure was one browser-side race taking down the server for the rest of the suite -- seventy `ERR_CONNECTION_REFUSED` failures, three attempts each, none of them naming the event. Patch wrangler with upstream's own fix (cloudflare/workers-sdk#15207, issue #15203): report the failed request and keep serving. Two call sites, because wrangler bundles the ProxyController twice. Remove the patch when a release carries the fix -- a version bump that leaves it here fails the install rather than applying quietly. `patches/**` joins the js paths filter: a patched dependency is application behaviour, and editing it must run the suite that proves it. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
+💯 priority to fix. This is blocking us in development. In the meantime, we're using the patch. |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
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.
Fixes #15203.
Refs #14926 and #14641.
Customer Summary
wrangler devrunning when proxying one local request fails, instead of terminating the development session and its dependent test runner.Network connection lost.) rather than an empty fatal diagnostic.Technical Summary
ProxyWorkerfetch errors as request-scoped failures and logs them without dispatching a fatal controllererrorevent.Why
ProxyWorkeralready rejects the affected request. Promoting its serialized error to the dev environment's fatal error bus unnecessarily shuts downwrangler dev, which then causes parallel Playwright processes to receive SIGTERM.Testing
pnpm -w test:ci -F wrangler -- ProxyController.test.tspnpm prettifypnpm check(203 tasks passed)Network connection lost.A picture of a cute animal (not mandatory, but encouraged)