Repository navigation
ref(deno): Use a shared request handler wrapper for Deno.serve - #25586
Conversation
size-limit report 📦Compared: 3555c35 (PR test merge using develop at d66dbfd) Against: ad71ef6 (develop) · base run #63604
|
0e901b1 to
bf847fb
Compare
bf847fb to
e2c327d
Compare
e2c327d to
904c22c
Compare
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.
6bfff61 to
c992cee
Compare
c992cee to
dacacf0
Compare
Optional E2E testsSome optional checks were not successful. They do not block the merge. 5 not successful, 55 successful. See the run.
Successful checks
|
dacacf0 to
e0c1017
Compare
e0c1017 to
426ab70
Compare
6baab78 to
51a13db
Compare
51a13db to
cc1949a
Compare
5a4a067 to
7f39034
Compare
649937a to
fb05427
Compare
4a8f2f9 to
05a15aa
Compare
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) <[email protected]>
05a15aa to
1153ee8
Compare
JPeer264
left a comment
There was a problem hiding this comment.
The code has one regression, but once this is fixed it is ready to be shipped: AbortError a client disconnect seems to send an internal_error instead.
JPeer264
left a comment
There was a problem hiding this comment.
The code has one regression, but once this is fixed it is ready to be shipped: AbortError a client disconnect seems to send an internal_error instead.
Good catch! Fixed. |

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