Repository navigation
ref(deno): Use a shared request handler wrapper for Deno.serve - #25586
Conversation
size-limit report 📦Compared: fb0508a (PR test merge using develop at 465f86a) Against: b3e0c9e (develop) · base run #63030
|
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
| request, | ||
| client, | ||
| isolationScope, | ||
| options: client.getIntegrationByName<Integration & DenoServeIntegrationOptions>('DenoServe'), |
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?
There was a problem hiding this comment.
Ah, yes, that's a great catch! CheckServerRequestOptions makes sure each runtime declares every shared option. It doesn't check that the runtime actually passes the option through to the shared wrapper. The cast is exactly where that problem would sneak in.
Addressed in 6baab78, I'll apply the same sort of treatment for Bun and Cloudflare in the next 2 PRs in the stack.
c992cee to
dacacf0
Compare
Optional E2E testsSome optional checks were not successful. They do not block the merge. 3 failing, 56 successful. See the run.
Successful checks
|
dacacf0 to
e0c1017
Compare
e0c1017 to
426ab70
Compare
6baab78 to
51a13db
Compare
51a13db to
cc1949a
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) <noreply@anthropic.com>
cc1949a to
5a4a067
Compare

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