Repository navigation
feat(cloudflare): Export the channel integrations - #25584
Conversation
size-limit report 📦Compared: dbab22a (PR test merge using develop at c55fe8c) Against: 3ea9dc3 (develop) · base run #63478
|
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 2c4f115. Configure here.
2c4f115 to
2b12e9d
Compare
2b12e9d to
0078f5e
Compare
92f9004 to
a90fae3
Compare
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 59 successful. See the run.
Successful checks
|
a90fae3 to
af846b5
Compare
af846b5 to
78979a7
Compare
78979a7 to
adb8e1a
Compare
adb8e1a to
5dfe525
Compare
5dfe525 to
6084ce0
Compare
e3b5ac5 to
73b75c7
Compare
568306d to
5216114
Compare
When the `@sentry/cloudflare/vite` plugin bundles an instrumented
package, such as `pg` or `openai`, the SDK adds the matching channel
integration. It calls each factory with no arguments, so a Cloudflare
user always got the default options. They could not, for example, turn
off prompt and response capture with
`openAIIntegration({ recordInputs: false })`, as Node, Bun and Deno
users can.
`@sentry/cloudflare` now exports the channel integrations that Node
exports. These are the integrations that the vite plugin can register,
so their code already runs on workerd. A user instance passed in
`integrations` replaces the registered default with the same name, at
`init()` and also when the module loads after `init()`. Both packages
set `"sideEffects": false`, so a worker bundles only the integrations
it imports. The `withSentry` bundle does not change in size.
These integrations get data only when the vite plugin injected the
channels. Without the plugin, a configured integration records nothing.
On Cloudflare, `invokeOrchestrionInstrumentation` now logs a debug
warning, once for each integration, when the plugin did not run.
Fixes #25575
Fixes JS-3973
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
5216114 to
b82cfb8
Compare
| import { defineConfig } from 'vite'; | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [cloudflare(), sentryCloudflareVitePlugin({ autoInstrumentation: false })], |
There was a problem hiding this comment.
q: Why is autoInstrumentation turned off?
|
Btw this PR is doing a little bit more than just exporting the channel integrations. Maybe "Export and override channel integrations" or something like that would be better (btw don't forget to update the changelog in case the title gets updated). WDYT? |

When the
@sentry/cloudflare/viteplugin bundles an instrumented package, such aspgoropenai, the SDK adds the matching channel integration. It calls each factory with no arguments, so a Cloudflare user always got the default options. They could not, for example, turn off prompt and response capture withopenAIIntegration({ recordInputs: false }), as Node, Bun and Deno users can.@sentry/cloudflarenow exports the channel integrations that Node exports. These are the integrations that the vite plugin can register, so their code already runs on workerd. A user instance passed inintegrationsreplaces the registered default with the same name, atinit()and also when the module loads afterinit(). Both packages set"sideEffects": false, so a worker bundles only the integrations it imports. ThewithSentrybundle does not change in size.These integrations get data only when the vite plugin injected the channels. Without the plugin, a configured integration records nothing. On Cloudflare,
invokeOrchestrionInstrumentationnow logs a debug warning, once for each integration, when the plugin did not run.Fixes #25575
Fixes JS-3973