You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NodeRequest.arrayBuffer() throws a bare TypeError (not AbortError) after a client disconnect #293
Version: srvx 0.11.22, Node v24.18.1, HTTP/2 (Http2ServerRequest/Http2ServerResponse, via the TanStack Start vite dev middleware).
What happens: a handler that does await request.arrayBuffer() on a NodeRequest gets a TypeError — not an AbortError — when the client cancels the stream while the handler is in flight:
TypeError: Response body object should not be disturbed or locked
at extractBody (node:internal/deps/undici/undici:6919:17)
at new Request (node:internal/deps/undici/undici:12285:48)
at get _request (srvx/dist/adapters/node.mjs:357:21)
at desc.value [as arrayBuffer] (srvx/dist/_chunks/_url.mjs:22:16)
At that moment request.signal.aborted is still false (the abort fires from the resclose handler a beat later).
Why it matters: callers cannot distinguish "client hung up" from "malformed request". Idiomatic proxy code (if (request.signal.aborted || err.name === 'AbortError') return 499) falls through to a 5xx branch and logs an error for every cancelled request.
Suggested fix: in get _request, guard the body handoff — if the body stream is already disturbed/locked or the underlying req is destroyed or errored, construct the native Request with a null body and let signal carry the abort, or surface the abort reason as an AbortError instead of letting undici's extractBody invariant leak.
Caveat: not yet minimized outside our app; it reproduces reliably under h2 with a mid-flight NGHTTP2_CANCEL (client aborts a POST ~20 ms in while the handler reads the body), and we could not trigger it with a synthetic h1 harness.
Activity
fix(node): reject body reads with the abort reason after a client dis…