Skip to content

deno: denoServeIntegration lacks the incoming request options that denoHttpIntegration has #25492

Open

Description

@isaacs

Deno has two server integrations.

denoHttpIntegration covers node:http servers. denoServeIntegration covers Deno.serve, which is the native server and the one most Deno apps use.

denoServeIntegration takes only two options: maxRequestBodySize and the deprecated ignoreStatusCodes. denoHttpIntegration takes many more options for incoming requests. So a user who moves from node:http to Deno.serve loses control over what the SDK captures.

The option a user is most likely to need is ignoreRequestBody. Today a Deno.serve user can only turn body capture on or off for all routes. They cannot skip a health check, a file upload, or a route that receives secrets. Node (httpIntegration), Cloudflare (httpServerIntegration) and Deno's own denoHttpIntegration all have this option.

Proposed options

Use the same names and semantics as denoHttpIntegration. Callbacks get the web Requestinstead of a node:http IncomingMessage, which matches Cloudflare's httpServerIntegration.

Option Type Default Notes
ignoreRequestBody (url: string, request: Request) => boolean none Main ask. Skip body capture when the callback returns true. url is the full URL, as in Cloudflare.
ignoreIncomingRequests (urlPath: string, request: Request) => boolean none Skip the server span for a request. Errors in the handler are still captured.
ignoreStaticAssets boolean true Skip spans for favicon.ico, robots.txt, *.cssand so on. Use isStaticAssetRequestfrom @sentry/core/server. Defaulting to truechanges current behavior, so it needs a changelog note.
spans boolean hasSpansEnabled(options) Turn off Deno.servespans but keep error capture and request data.
onSpanCreated (span: Span, request: Request) => void none Runs after the server span starts.
onSpanEnd (span: Span, request: Request, response: Response) => void none Runs before the server span ends. With a streamed response, it runs when the stream finishes.

Needs a decision: sessions and sessionFlushingDelayMS

denoHttpIntegration records request sessions (#22888 turned them on), but Deno.serve does not. So release health for most Deno apps shows no request sessions. The shared helper recordRequestSession in @sentry/core/server waits for a node:http response close event. Deno.serve needs a small adapter, or the helper needs a callback form. This is bigger than the other options and could be its own issue.

Implementation notes

  • All the code is in packages/deno/src/integrations/deno-serve.ts and packages/deno/src/wrap-deno-request-handler.ts.
  • The wrapper already reads maxRequestBodySize from the integration instance through client.getIntegrationByName('DenoServe'). New options can be read the same way.
  • Check ignoreRequestBody in the wrapper next to the existing request.method !== 'GET' check, before captureBodyFromWinterCGRequest. The request body can only be read once, so the check must run before the SDK clones or reads it.
  • Cloudflare's captureIncomingRequestBody inpackages/cloudflare/src/integrations/httpServer.ts already does this for a web Request. Consider moving it to @sentry/core so both runtimes share it.
  • Leave ignoreStatusCodes as it is. It is deprecated, and it only works with traceLifecycle: 'static'.

Tests

  • Unit tests in packages/deno/test/deno-serve.test.ts for each option.
  • For ignoreRequestBody, check that the event has no request.data when the callback returns true, and that the handler can still read the body.
  • For ignoreIncomingRequests and ignoreStaticAssets, check that no server span is sent and that a thrown error is still captured.

Related

Activity

  1. linear-code commented on Oct 18, 2026

    @linear-code
  2. added
    javascriptPull requests that update javascript code
    on Oct 18, 2026
  3. self-assigned this
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions