getsentry / getsentry/sentry-javascript

bun: `Bun.serve` does not support streaming responses

Aperta
#23,883 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Bug Bun javascript Spans
Lingua principale
TypeScript
Stelle
8.7k
Fork
1.8k
Merge medio
1g 17h
PR unite (30g)
523

Descrizione

`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`.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start in packages/bun/src/integrations/bunserver.ts:189 at wrapRequestHandler and compare the Deno streamResponse and Cloudflare classifyResponseStreaming plus TransformStream implementations. Review the D10 proposal for placing classifyResponseStreaming, then verify with a streaming response that the span remains open until the body finishes rather than ending when the handler returns.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
bun, typescript
Ambito
backend, observability
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
65/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.