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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ jobs:
# reached CI without running the Action's own suite.
- 'scripts/**'
- 'action/**'
# A patched dependency is application behaviour, not metadata:
# `patches/wrangler@*.patch` is the only thing keeping `wrangler
# dev` alive under the e2e suite. Editing it must run the suite
# that proves it still works.
- 'patches/**'
e2e:
- *js
- 'e2e/**'
Expand Down Expand Up @@ -371,6 +376,12 @@ jobs:
# The dmesg grep is the other half: a SIGKILL with no exit code is the OOM
# killer, and that is a different fix from a crash.
#
# It was neither. `code=1 signal=null`, no OOM kill recorded, 8 GB free --
# `wrangler dev` exited on ONE failed proxied request, reporting it as
# `✘ [ERROR]` with an empty message. That bug is patched; see
# `pnpm-workspace.yaml`. This step stays because it is what made the answer
# readable from the job page, and the next death will be a different one.
#
# ON PUBLISHING THIS LOG, since `playwright.config.ts` turns screenshots
# off over exactly this concern: the e2e Worker holds no secret. Its
# `MASTER_KEY` and every seeded value are committed constants in
Expand Down
11 changes: 11 additions & 0 deletions e2e/harness/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,17 @@ export async function startDevServer(options: {
* So record the death where the evidence already is, with the two fields that
* decide the diagnosis: a `signal` of SIGKILL is the OOM killer, a non-zero
* `code` is workerd deciding to stop on its own.
*
* That death had ONE cause, and it is now fixed rather than watched for. A
* single proxied request that failed -- `Network connection lost.`, raised
* when a client disconnects mid-upload, which is what Playwright does every
* time it closes a page while a form POST is in flight -- was fatal to the
* whole dev server, and was reported as `✘ [ERROR]` with an empty message.
* `pnpm-workspace.yaml` carries the upstream patch and the full explanation.
*
* This listener stays regardless. It cost nothing, it is what turned seventy
* identical `ERR_CONNECTION_REFUSED` failures into one legible line, and the
* next reason the Worker dies will not be that one.
*/
let exited: { code: number | null; signal: NodeJS.Signals | null } | null = null;
child.once("exit", (code, signal) => {
Expand Down
28 changes: 28 additions & 0 deletions patches/wrangler@4.121.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/wrangler-dist/cli.js b/wrangler-dist/cli.js
index 9345fc99a8922769799e1a3008feb34d83400b81..893aaf2e91ae6f00a7e1e2e5f6ff21b3bb68a2ee 100644
--- a/wrangler-dist/cli.js
+++ b/wrangler-dist/cli.js
@@ -183957,7 +183957,10 @@ var init_dist12 = __esm({
this.onPreviewTokenExpired();
break;
case "error":
- this.emitErrorEvent("Error inside ProxyWorker", message.error);
+ logger3.error(
+ "Error proxying request to the local Worker:",
+ message.error.message
+ );
break;
}
}
@@ -279576,7 +279579,10 @@ var init_ProxyController = __esm({
this.emitPreviewTokenExpiredEvent(message.proxyData);
break;
case "error":
- this.emitErrorEvent("Error inside ProxyWorker", message.error);
+ logger2.error(
+ "Error proxying request to the local Worker:",
+ message.error.message
+ );
break;
case "debug-log":
logger2.debug("[ProxyWorker]", ...message.args);
17 changes: 10 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,41 @@ catalog:
vite-plus: 0.2.9
vitest: 4.1.10
wrangler: 4.121.0

# -----------------------------------------------------------------------------
# One upstream bug, patched here until it ships.
#
# `wrangler dev` treats a SINGLE failed proxied request as fatal to the whole
# dev server. Every request the browser makes is forwarded by wrangler's own
# ProxyWorker to the Worker runtime; if 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.
#
# It exits SILENTLY. The rejection crosses a Worker boundary, so the cause is a
# plain object rather than an Error; `castErrorCause` wraps it in `new Error()`,
# whose message is "". The entire report is `✘ [ERROR]` with nothing after it.
#
# The inner fetch rejects with `Network connection lost.` when a client
# disconnects while its request body is still being uploaded -- which a browser
# does routinely, e.g. Playwright closing a page while a form POST is in flight.
# That is a client event, not a server fault, and it killed `e2e` mid-run:
# `wrangler dev` died about twenty tests in and every remaining spec failed with
# `ERR_CONNECTION_REFUSED`, three attempts each, none of them naming the cause.
# Re-running the job "fixed" it because the race simply did not recur.
#
# The patch is upstream's own fix, applied to the shipped bundle: report the
# failure and keep serving. It is two call sites because wrangler bundles the
# ProxyController twice (its own, and the remote-bindings copy).
#
# issue https://github.com/cloudflare/workers-sdk/issues/15203
# fix https://github.com/cloudflare/workers-sdk/pull/15207
#
# REMOVE THIS -- both the patch file and the entry below -- as soon as a
# wrangler release contains the fix. A version bump that leaves it here fails
# the install rather than applying quietly, which is the intended prompt to go
# and check.
# -----------------------------------------------------------------------------
patchedDependencies:
wrangler@4.121.0: patches/wrangler@4.121.0.patch
Loading