@@ -14,14 +14,22 @@ import {
1414import type { CloudflareClientOptions , CloudflareOptions } from './client' ;
1515import { CloudflareClient } from './client' ;
1616import { makeFlushLock } from './flush' ;
17- import { channelIntegrations , isOrchestrionInjected } from '@sentry/server-utils/orchestrion' ;
1817import { httpServerIntegration } from './integrations/httpServer' ;
1918import { fetchIntegration } from './integrations/fetch' ;
2019import { honoIntegration } from './integrations/hono' ;
2120import { setupOpenTelemetryTracer } from './opentelemetry/tracer' ;
2221import { makeCloudflareTransport } from './transport' ;
2322import { defaultStackParser } from './vendor/stacktrace' ;
2423
24+ /**
25+ * Exact copy of the function from `@sentry/server-utils/orchestrion`.
26+ * This is to avoid importing the orchestrion package directly into the cloudflare package.
27+ * TODO(v11): Use `@sentry/server-utils/orchestrion` once we move to `nodejs_compat` by default
28+ */
29+ function getRegisteredChannelIntegrations ( ) : Integration [ ] {
30+ return ( globalThis . __SENTRY_ORCHESTRION__ ?. integrations || [ ] ) . map ( factory => factory ( ) ) ;
31+ }
32+
2533/** Get the default integrations for the Cloudflare SDK. */
2634export function getDefaultIntegrations ( options : CloudflareOptions ) : Integration [ ] {
2735 // TODO(v11): Drop this transitional gating and let `requestDataIntegration` rely on the resolved
@@ -47,9 +55,11 @@ export function getDefaultIntegrations(options: CloudflareOptions): Integration[
4755 consoleIntegration ( ) ,
4856 // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The
4957 // `@sentry/cloudflare/vite` plugin injects the channels at build time and
50- // sets the orchestrion bundler marker; without it the channels never fire,
51- // so only add the subscribers when injection actually happened.
52- ...( isOrchestrionInjected ( ) ? Object . values ( channelIntegrations ) . map ( factory => factory ( ) ) : [ ] ) ,
58+ // adds a generated registration module to the bundle, which puts the
59+ // subscriber factories on the global marker. Read from there instead of
60+ // importing them so bundles built without the plugin — where the channels
61+ // would never fire — don't ship the code.
62+ ...getRegisteredChannelIntegrations ( ) ,
5363 ] ;
5464}
5565
0 commit comments