Uh oh!
There was an error while loading. Please reload this page.
feat(bun, deno): Migrate request instrumentation to dataCollection - #21261
Conversation
Replace the legacy `sendDefaultPii` reads in the Bun `bunServerIntegration` and the Deno request handler with `client.getDataCollectionOptions()`, so the `dataCollection` API is honored. Behavior for `sendDefaultPii`-only users is unchanged (core bridges the flag to the resolved config). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chargome
commented
Jun 1, 2026
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 63a127f. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
| const dataCollection = client?.getDataCollectionOptions(); | ||
| Object.assign(attributes, httpHeadersToSpanAttributes(request.headers.toJSON(), sendDefaultPii)); | ||
| Object.assign(attributes, httpHeadersToSpanAttributes(request.headers.toJSON(), dataCollection)); |
There was a problem hiding this comment.
Bug: Passing undefined from client?.getDataCollectionOptions() to httpHeadersToSpanAttributes causes a runtime crash when the Sentry client is not initialized.
Severity: CRITICAL
Suggested Fix
Provide a fallback value to prevent passing undefined. Change the call to httpHeadersToSpanAttributes(request.headers.toJSON(), client?.getDataCollectionOptions() ?? false) to align with the pattern used in other integrations.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/bun/src/integrations/bunserver.ts#L211-L213
Potential issue: When `getClient()` returns `undefined`, the expression
`client?.getDataCollectionOptions()` also evaluates to `undefined`. This `undefined`
value is then passed as the `dataCollection` argument to the
`httpHeadersToSpanAttributes` function. The function's default parameter is not
triggered when `undefined` is explicitly passed. Consequently, an internal variable
`resolvedDataCollection` becomes `undefined`, leading to a runtime error when the code
attempts to access `resolvedDataCollection.httpHeaders`. This can cause a server crash
during HTTP request handling if the Sentry client is not initialized.
Also affects:
packages/bun/src/integrations/bunserver.ts:245~245
Did we get this right? 👍 / 👎 to inform future reviews.

Migrates the Bun (
bunServerIntegration) and Deno (wrapDenoRequestHandler) HTTP server instrumentation off the legacysendDefaultPiiflag and onto thedataCollectionAPIcloses#20935