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
Commit e2c327d
Browse filesBrowse the repository at this point in the historyBrowse files
ref(deno): Use a shared request handler wrapper for Deno.serve
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>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,14 @@ Work in this release was contributed by @adityareddy-dev, @jpdefo, @Jxxunnn, @ph
96
96
97
97
When an instrumented package loaded after `init()` (for example through a dynamic `import()`), the SDK added its integration even if the user had removed it. This applied to an `integrations` function that filtered it out, `defaultIntegrations: false`, and a custom `defaultIntegrations` list. The SDK now applies the same rules to a late-loaded integration as to the defaults at `init()`. To do this, it calls an `integrations` function again, once for each package that loads after `init()`.
98
98
99
+
- **ref(deno): Use the shared request handler wrapper for `Deno.serve`**
100
+
101
+
`Deno.serve` now uses a request handler wrapper that `Bun.serve` and Cloudflare will also use. Three small changes for Deno users:
102
+
103
+
- When the source of a streamed response fails, the SDK now captures the error and marks the span as failed.
104
+
- The SDK no longer reads a streamed response ahead of the client.
105
+
- Errors in `OPTIONS` and `HEAD` requests now carry the request data.
0 commit comments