[wrangler] Log ProxyWorker request error details at debug level - #15207
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 294f30a 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
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@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
|
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
This was referenced Sep 4, 2026
…est-errors # Conflicts: # .changeset/tidy-pandas-smile.md
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
Contributor
|
The improvement here seems extremely sensible. I can definitely get behind this! |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
cjol
approved these changes
Sep 22, 2026
workers-devprod
approved these changes
Sep 22, 2026
workers-devprod
left a comment
Contributor
There was a problem hiding this comment.
Codeowners reviews satisfied
Merged
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.
Refs #15203, #14926, #14641.
Since #15252, a failed request proxied to the local Worker is logged and
wrangler devkeeps running. That log shows only the error message, though, such asNetwork connection lost.. The stack and cause chain, which are the only clues to why the connection failed, aren't logged even with--log-level debug.This PR:
DevEnv's handler forError inside ProxyWorker, the same way the other non-fatalProxyControllererrors are logged;cause.cause.message, left over from before [wrangler] Preserve serialized error details in castErrorCause #14906.castErrorCausenow preserves the message itself, and.causeholds the real underlying cause, so the fallback could report the wrong message.