getsentry / getsentry/sentry-javascript

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

Ouverte
#23,883 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Bug Bun javascript Spans
Langage dominant
TypeScript
Étoiles
8.7k
Forks
1.8k
Merge moyen
1 j 17 h
PR mergées (30 j)
515

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
bun, typescript
Domaine
backend, observability
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
65/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.