Repository navigation
Document incoming request options and Cloudflare channel integrations for the server SDKs #20331
Description
Background
A stack of changes in getsentry/sentry-javascript aligns the incoming HTTP request options and the exports of the Node, Bun, Deno and Cloudflare SDKs. Tracking issue: getsentry/sentry-javascript#25538. Several changes need docs. The SDK issues are listed with each section. The SDK PRs are not merged yet, so check the released version before you publish.
The main docs change is section 1 (Cloudflare channel integrations). Sections 2 to 5 cover the other user-facing changes in the same stack.
1. Cloudflare: configure channel integrations
SDK issue: getsentry/sentry-javascript#25575
What changed
The @sentry/cloudflare/vite plugin instruments supported packages at build time (for example pg, mysql2, redis, openai, @anthropic-ai/sdk, @langchain/*, express, hono). When the plugin bundles one of these packages, the SDK adds the matching integration automatically, with its default options.
Before, users could not set options on these integrations, because @sentry/cloudflare did not export them. Now it exports them, so users can pass a configured instance in integrations. The configured instance replaces the default one.
Exported integrations: amqplibIntegration, anthropicAIIntegration, awsIntegration, dataloaderIntegration, expressIntegration, firebaseIntegration, genericPoolIntegration,googleGenAIIntegration, graphqlIntegration, groqIntegration, hapiIntegration, kafkaIntegration, knexIntegration, koaIntegration, langChainIntegration, langGraphIntegration, lruMemoizerIntegration, mastraIntegration, mcpServerIntegration,mistralAIIntegration, mongoIntegration, mongooseIntegration, mysql2Integration, mysqlIntegration, neonIntegration, nitroIntegration, openAIIntegration, piDurableIntegration, postgresIntegration, postgresJsIntegration, redisIntegration,tediousIntegration, togetherAIIntegration, typesafeIntegration, and SentryMastraExporter. (honoIntegration, prismaIntegration and vercelAIIntegration were already exported.)
The options are the same as in the Node SDK. The most important case is the AI integrations: users can now turn off prompt and response capture on Cloudflare.
import * as Sentry from '@sentry/cloudflare';
export default Sentry.withSentry(
env => ({
dsn: env.SENTRY_DSN,
integrations: [Sentry.openAIIntegration({ recordInputs: false, recordOutputs: false })],
}),
handler,
);
Requirement to state clearly
These integrations get data only when the @sentry/cloudflare/vite plugin is in the Vite config. Without the plugin, an integration in integrations records nothing. With debug: true, the SDK logs a warning that names the integration and the plugin.
Importing an integration does not add code for the others. A worker bundles only the integrations it imports.
Suggested docs changes
- Cloudflare platform docs, on the page or section about the Vite plugin and build-time instrumentation: explain that the plugin adds these integrations automatically, and how to configure one by passing it in
integrations. Use the example above. - Each integration page under the JavaScript integrations docs that lists supported SDKs: add Cloudflare where the integration is now exported, with a note that it needs the Vite plugin. Check the AI integration pages first (OpenAI, Anthropic, Google GenAI, LangChain, LangGraph, Mistral, Groq, Together AI), because users most need their
recordInputs/recordOutputsoptions.
2. Bun: bunServerIntegration options and request sessions
SDK issue: getsentry/sentry-javascript#25571
bunServerIntegration (instruments Bun.serve) now accepts:
| Option | Default | Meaning |
|---|---|---|
maxRequestBodySize |
'medium' |
Existing option. Max size of request bodies attached to events. |
ignoreRequestBody |
none | (url, request: Request) => boolean. Skip body capture when it returns true. If it throws, the body is skipped. |
ignoreIncomingRequests |
none | (urlPath, request: Request) => boolean. Skip the span when it returns true. urlPath includes the query string. Errors are still captured. |
ignoreStaticAssets |
true |
Skip spans for GET requests to static assets such as favicon.ico, robots.txt or *.js. |
spans |
client tracing config | Whether to create spans. Errors and request data are still captured when false. |
onSpanCreated |
none | (span, request: Request) => void. Runs after the span starts, before the handler. |
onSpanEnd |
none | (span, request: Request, response: Response) => void. Runs before the span ends. For a streamed response, when the stream finishes. Not called when the handler throws. |
sessions |
true |
Record a request session for each request (release health). Needs release. |
sessionFlushingDelayMS |
60000 |
Delay before the session aggregate is sent. |
Behavior changes to mention: static asset requests no longer create spans by default, no spans when tracing is disabled, and errors thrown for OPTIONS and HEAD requests are now captured.
These options match denoServeIntegration in the Deno SDK. If the Deno docs already describe those options, the Bun docs can follow the same structure.
3. Cloudflare: httpServerIntegration span options
SDK issue: getsentry/sentry-javascript#25573
Cloudflare's httpServerIntegration had only maxRequestBodySize and ignoreRequestBody. It now also accepts ignoreIncomingRequests, ignoreStaticAssets (default true), spans (defaults to the client tracing config), onSpanCreated and onSpanEnd, with the same meaning as in the Bun table above. The callbacks receive the web Request and Response.
Cloudflare does not support sessions or sessionFlushingDelayMS. A worker has no long-lived process to run the timer that sends session aggregates.
Behavior changes to mention: static asset requests no longer create spans by default, and no request spans when tracing is disabled. If ignoreRequestBody throws, the request no longer fails, and the body is skipped.
4. Node: onSpanEnd on httpIntegration
SDK issue: getsentry/sentry-javascript#25572
httpIntegration (and httpServerSpansIntegration) now accept onSpanEnd: (span, request, response) => void. It runs when the response for an incoming request finishes, after the SDK sets the response status on the span, before the span ends. request is the IncomingMessage and response the ServerResponse. Add it next to onSpanCreated in the httpIntegration options docs. Bun re-exports Node's httpIntegration, so it applies there too.
Also in httpIntegration: the request argument of ignoreRequestBody is now typed as the incoming IncomingMessage, which is what the SDK always passed. If the docs say it is a RequestOptions object, correct that.
5. New exports (only where the docs list exports)
SDK issue: getsentry/sentry-javascript#25574
- Node and Bun now export
moduleMetadataIntegration,instrumentPostgresJsSql,instrumentCreateReactAgentandawsIntegration. - Deno and Cloudflare now export
parameterizeandinstrumentStateGraphCompile. - Deno now exports
fastifyIntegration.
Update any "supported SDKs" lists on the pages for these APIs.
Done when
- The Cloudflare docs explain how to configure an integration that the Vite plugin adds, with the requirement that the plugin is present.
- The AI integration pages show Cloudflare as supported, with the Vite plugin note.
- The Bun and Cloudflare request integration docs list the new options and the default changes.
- The Node
httpIntegrationdocs listonSpanEnd.
Activity
linear-code commentedon Oct 29, 2026
DOCS-2968