Skip to content

bun: Bun.serve does not support streaming responses #23883

Description

@isaacs

wrapRequestHandler in packages/bun/src/integrations/bunserver.ts:189 uses startSpan, which ends the span as soon as the handler returns. Deno (streamResponse) and Cloudflare (classifyResponseStreaming plus a TransformStream) both keep the span open until the body finishes.

An SSE or LLM streaming route on Bun reports a span duration covering only the handler, not the stream. This is the common shape for AI apps, which are a large part of the Bun audience.

Work item. Move classifyResponseStreaming into @sentry/core or @sentry/server-utils (see D10) and adopt it in bunserver.ts with startSpanManual.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions