Title: Cloudflare adds back channel integrations the user removed, when the module loads after `init()` · Issue #25576 · getsentry/sentry-javascript · GitHub
Open Graph Title: Cloudflare adds back channel integrations the user removed, when the module loads after `init()` · Issue #25576 · getsentry/sentry-javascript
X Title: Cloudflare adds back channel integrations the user removed, when the module loads after `init()` · Issue #25576 · getsentry/sentry-javascript
Description: The @sentry/cloudflare/vite plugin adds a snippet to each instrumented module (for example openai, pg). When the module first runs, the snippet stores an integration factory on a global marker and emits orchestrion.module-injected. At in...
Open Graph Description: The @sentry/cloudflare/vite plugin adds a snippet to each instrumented module (for example openai, pg). When the module first runs, the snippet stores an integration factory on a global marker and ...
X Description: The @sentry/cloudflare/vite plugin adds a snippet to each instrumented module (for example openai, pg). When the module first runs, the snippet stores an integration factory on a global marker and ...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25576
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cloudflare adds back channel integrations the user removed, when the module loads after `init()`","articleBody":"The `@sentry/cloudflare/vite` plugin adds a snippet to each instrumented module (for example `openai`, `pg`). When the module first runs, the snippet stores an integration factory on a global marker and emits `orchestrion.module-injected`. At `init()`, Cloudflare adds every factory already stored to the default integrations.\n\nA module can run after `init()`, for example a driver loaded with a dynamic `import()` on first use. For that case, `packages/cloudflare/src/baseSdk.ts:158` listens for the event and calls`client.addIntegration(factory())`. It does not check the user's options, so it ignores each way a user can opt out:\n\n* `integrations: defaults => defaults.filter(i => i.name !== 'OpenAI')`\n* `defaultIntegrations: false`\n* `defaultIntegrations: [...]`, a custom list without the integration\n\nThe user gets the integration they removed. For the AI integrations, that can mean prompt and response capture that the user turned off on purpose. Whether it happens depends on module load order, so it is hard to see.\n\nA user instance that the user passed in `integrations` is safe: `addIntegration` skips a name that is already installed.\n\n### **Proposed solution**\n\nApply the same rules to a late factory as `init()` applies to the defaults. In `initWithDefaultIntegrations`:\n\n1. Before the SDK fills in `options.defaultIntegrations`, save whether the user set it. If the user set it (`false` or a custom list), the SDK defaults are off, so the handler does not add late integrations.\n2. If `options.integrations` is a function, pass the late integration through it with core's `getIntegrationsToSetup`, as the only default. Install the result entry with the same name, if there is one. If the filter removed it, do nothing. Ignore other entries in the result. Those are already installed from `init()`.\n3. If `options.integrations` is an array, keep today's behavior. An array cannot remove a default, and `addIntegration` already skips a name the user configured.\n\nTrade-off for step 2: the SDK calls the user's `integrations` function again, once for each late module. Most of these functions only filter or add to the list. A function with side effects would run them again. Document this on the `integrations` option for Cloudflare. The other choice is to save, at `init()`, which integration names the filter removed, but that only covers modules that were already loaded, which is the case that works today.\n\nTests in `packages/cloudflare/test/sdk.test.ts` (it already covers the event): each opt-out form above, plus a configured user instance that must stay in place when its module loads later.","author":{"url":"https://github.com/isaacs","@type":"Person","name":"isaacs"},"datePublished":"2026-10-20T17:08:32Z","url":"https://github.com/getsentry/sentry-javascript/issues/25576"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1cfc7c4b-0bb1-fb45-b8ff-4727352dda08 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F62:8414A:10004A4:1666EA5:6B0449ED |
| html-safe-nonce | e6bc99db11dbd0eafe4d5f752728ebb05911faef1a13c0c5d26c94f4543203d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjYyOjg0MTRBOjEwMDA0QTQ6MTY2NkVBNTo2QjA0NDlFRCIsInZpc2l0b3JfaWQiOiIxNzY0NzI4NzIyODYwMjk2Njg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 12c8e8e0f928a36297b2643f5fbeb575db2c46513854339b78ca67714970a299 |
| hovercard-subject-tag | issue:5946090288 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25576/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0b45269cf7727881b3077c8329791cb454cda771428a9737ec39c91ecf1eac5/getsentry/sentry-javascript/issues/25576 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0b45269cf7727881b3077c8329791cb454cda771428a9737ec39c91ecf1eac5/getsentry/sentry-javascript/issues/25576 |
| og:image:alt | The @sentry/cloudflare/vite plugin adds a snippet to each instrumented module (for example openai, pg). When the module first runs, the snippet stores an integration factory on a global marker and ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | isaacs |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width