Repository navigation
Conversation
Restores what #26616 dropped after its type build failed: `defineIntegration` keeps a copy of the options the user passed, the integrations that bypassed it use it again (with typed exports so declarations build), and every framework and downstream SDK captures the user's options before adding its defaults. The SDK config reports the user's integrations under `options.integrations`. An `integrations` function is reported as a change to the defaults: what it added, plus the sorted names of the defaults it dropped at the top level as `removed_default_integrations`.
size-limit report 📦Compared: 8d73041 (PR test merge using develop at d8564c0) Against: d8564c0 (develop) · base run #67328 ✅ Baseline matches: this diff contains only this PR's changes.
|
|
One or more gzipped bundles increased by more than 500 bytes. If this increase is intentional, add the Accept Bundlesize Increase label to this PR to rerun and accept the check. |
Optional E2E testsSome optional checks were not successful. They do not block the merge. 6 not successful, 54 successful. See the run.
Successful checks
|
Wrapping the integration function to capture its options made every `defineIntegration()` call look side-effecting, so bundlers kept unused integrations. Mark it as free of side effects.
…tegration-options # Conflicts: # packages/core/src/integrations/reportSdkConfig.ts # packages/core/test/lib/integrations/reportSdkConfig.test.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1b0bb70. Configure here.
| } | ||
|
|
||
| return resolved; | ||
| }, |
There was a problem hiding this comment.
Callback wrapper assumes array return
Medium Severity
The new integrations function wrapper calls .map on the callback result immediately, but getIntegrationsToSetup still accepts a single integration and wraps it in an array. Returning one integration, null, or undefined from the callback now throws during init instead of being coerced. That can take down the host app for a previously tolerated pattern.
Reviewed by Cursor Bugbot for commit 1b0bb70. Configure here.
| return initServer({ | ||
| runtime: { name: 'bun', version: process.versions.bun as string }, | ||
| ...options, | ||
| ...userOptions, |
There was a problem hiding this comment.
Next.js runtimes leak SDK integrations
Medium Severity
On Next.js Bun and Deno, an integrations callback is invoked with extra SDK-injected instances (fetchIntegration, bunHttpServerIntegration) that never get isDefaultInstance. The capture wrapper then treats those as user-set, so the config payload reports them (including { spans: false }) as if the app added them. An integrations array does not have this leak.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 1b0bb70. Configure here.
| const integration = fn(...args) as ReturnType<Fn>; | ||
| integration._options = options; | ||
|
|
||
| return integration; |
There was a problem hiding this comment.
Runtime objects serialized as options
Medium Severity
Wrapping tracing integrations with defineIntegration stores the entire first argument as _options. For Vue, Ember, and React Router v4/v5 that includes live router, appInstance, or history objects. isPlainObject treats class instances as walkable, so the config report can recurse the live object graph and send route query data (PII) or a huge payload. TanStack Router already omits the router for this reason.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 1b0bb70. Configure here.


Previously we dropped the default resolved options to trim down the payload, this PR continues that by dropping the default integrations and only reports what the user has set explicitly, including the explicitly set options.
Notable changes to the payload:
integrationsintooptions, since now it represents what the user has passed explicitly.removed_default_integrationmetadata field, that is only present if the user uses a callback filter for integrations.defineIntegrationto capture their options and that all SDKs capture at the top-level rather than leaking defaults to upstream SDKs like Vue -> Browser.{ "version": 3, "sdk": { "name": "sentry.javascript.node", "version": "11.16.0" }, "environment": "production", - "integrations": [ - { "name": "EventFilters" }, - { "name": "FunctionToString" }, - { "name": "LinkedErrors" }, - { "name": "CaptureConsole" }, - ], + "removed_default_integrations": ["Dedupe"], "options": { "environment": "production", + "integrations": [ + { "name": "CaptureConsole", "options": { "levels": ["error"] } }, + ], "tracesSampleRate": 0.2 } }This Builds on the #26677 PR stack, the changes seem like a lot but most are a couple of line changes.