Repository navigation
ref(deno): Use a shared request handler wrapper for Deno.serve - #25586
Conversation
isaacs
added this pull request to stack #25589
October 20, 2026 22:30
Contributor
size-limit report 📦
|
isaacs
force-pushed
the
isaacschlueter/js-3975-share-one-request-handler-wrapper-across-denoserve-bunserve
branch
from
October 21, 2026 00:49
0e901b1 to
bf847fb
Compare
isaacs
marked this pull request as ready for review
October 21, 2026 00:49
isaacs
requested review from
andreiborza and
mydea
and removed request for
a team
October 21, 2026 00:49
isaacs
force-pushed
the
isaacschlueter/js-3975-share-one-request-handler-wrapper-across-denoserve-bunserve
branch
from
October 21, 2026 01:07
bf847fb to
e2c327d
Compare
isaacs
force-pushed
the
isaacschlueter/js-3975-share-one-request-handler-wrapper-across-denoserve-bunserve
branch
from
October 21, 2026 01:13
e2c327d to
904c22c
Compare
isaacs
force-pushed
the
isaacschlueter/js-3975-share-one-request-handler-wrapper-across-denoserve-bunserve
branch
2 times, most recently
from
October 21, 2026 01:20
997d5b5 to
415525c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 415525c. Configure here.
Deno.serve, Bun.serve and Cloudflare each wrap a web `Request` handler with their own copy of the same steps: request data and body, the `http.server` span, streamed responses, errors and sessions. The copies drift, so a fix in one runtime does not reach the others. This adds `wrapServerRequestHandler` to `@sentry/server-utils` and moves `Deno.serve` onto it. Bun.serve and Cloudflare follow in separate PRs, so each runtime's changes can be reviewed alone. The wrapper has only what Deno needs today, and the next PRs extend it. It is exported from the shared entry, so the Node-free `@sentry/server-utils/no-diagnostic-channels` entry can use it too. The rules follow core's `node:http` server code. `OPTIONS` and `HEAD` requests get no span and no body capture, but still get request data, a session and error capture. The static asset filter applies only to `GET`. For streamed responses, the wrapper uses the stream monitor from the Bun SDK, which reads only when the client pulls and reports errors from the stream source. It replaces Deno's own copy, which read ahead of the client and ignored source errors. The existing Deno tests pass with no change. Visible changes for Deno: - An error from the source of a streamed response is now captured, and the span gets an error status. - The SDK no longer reads a streamed response ahead of the client. - Errors in `OPTIONS` and `HEAD` requests now carry the request data. - `client.address` is no longer set to the path of a Unix socket. Part of #25577 Part of JS-3975 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
isaacs
force-pushed
the
isaacschlueter/js-3975-share-one-request-handler-wrapper-across-denoserve-bunserve
branch
from
October 21, 2026 04:14
6bfff61 to
c992cee
Compare
mydea
reviewed
Oct 21, 2026
| request, | ||
| client, | ||
| isolationScope, | ||
| options: client.getIntegrationByName<Integration & DenoServeIntegrationOptions>('DenoServe'), |
Member
There was a problem hiding this comment.
is this right, does this have the full options? Maybe it would be nicer to have a utility like getDenoServeINtegration being exported from that file and keep that together, instead of having to cast this here, which could easily diverge?
This branch has not been deployed
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.

Deno.serve, Bun.serve and Cloudflare each wrap a web
Requesthandler with their own copy of the same steps: request data and body, thehttp.serverspan, streamed responses, errors and sessions. The copies drift, so a fix in one runtime does not reach the others.This adds
wrapServerRequestHandlerto@sentry/server-utilsand movesDeno.serveonto it. Bun.serve and Cloudflare follow in separate PRs, so each runtime's changes can be reviewed alone. The wrapper has only what Deno needs today, and the next PRs extend it. It is exported from the shared entry, so the Node-free@sentry/server-utils/no-diagnostic-channelsentry can use it too.The rules follow core's
node:httpserver code.OPTIONSandHEADrequests get no span and no body capture, but still get request data, a session and error capture. The static asset filter applies only toGET. For streamed responses, the wrapper uses the stream monitor from the Bun SDK, which reads only when the client pulls and reports errors from the stream source. It replaces Deno's own copy, which read ahead of the client and ignored source errors.The existing Deno tests pass with no change. Visible changes for Deno:
OPTIONSandHEADrequests now carry the request data.client.addressis no longer set to the path of a Unix socket.Part of #25577
Part of JS-3975