Repository navigation
Conversation
…tion An exception in a user callback must never crash the host app. The web `Request` handlers (Deno.serve, Bun.serve, Cloudflare) already guard their callbacks, but the `node:http` server code paths in core and Node did not. A throwing `onSpanCreated` left the span open and kept the request from reaching the user's handler. A throwing `onSpanEnd` skipped `span.end()` and surfaced as an uncaught exception from the response `close` event. Each callback now runs through `safeCallback`, which logs the error in debug builds and uses a fallback. `ignoreIncomingRequests` falls back to `false`, so the span is still created. `ignoreRequestBody` falls back to `true`, so a broken filter cannot leak the body it was meant to hide. These match the web `Request` handler fallbacks. Fixes #25590 Fixes JS-3976 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
isaacs
requested review from
JPeer264 and
mydea
and removed request for
a team
October 21, 2026 02:00
Contributor
size-limit report 📦Compared: bbafc87 (PR test merge using develop at 6fb6b07) Against: 6fb6b07 (develop) · base run #62924 ✅ Baseline matches: this diff contains only this PR's changes.
|
mydea
approved these changes
Oct 21, 2026
…llbacks-in-the-nodehttp-server
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 7 failing, 57 successful. See the run.
Successful checks
|
isaacs
deleted the
isaacschlueter/js-3976-node-guard-user-callbacks-in-the-nodehttp-server
branch
October 21, 2026 17:41
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.
An exception in a user callback must never crash the host app. The web
Requesthandlers (Deno.serve, Bun.serve, Cloudflare) already guard their callbacks, but thenode:httpserver code paths in core and Node did not.A throwing
onSpanCreatedleft the span open and kept the request from reaching the user's handler. A throwingonSpanEndskippedspan.end()and surfaced as an uncaught exception from the responsecloseevent.Each callback now runs through
safeCallback, which logs the error in debug builds and uses a fallback.ignoreIncomingRequestsfalls back tofalse, so the span is still created.ignoreRequestBodyfalls back totrue, so a broken filter cannot leak the body it was meant to hide. These match the webRequesthandler fallbacks.Fixes #25590
Fixes JS-3976