ref(server-utils): Remove addVercelAiProcessors and Vercel AI OTel span processing - #23384
Conversation
size-limit report 📦
|
14bb3ef to
d6aec87
Compare
d6aec87 to
7d9dff7
Compare
7d9dff7 to
29dd416
Compare
29dd416 to
b45c204
Compare
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 a3f614e. Configure here.
cd952c4 to
f4fb222
Compare
…span processing Removes the OpenTelemetry-span post-processing path for the Vercel AI SDK (`addVercelAiProcessors` and everything reachable only through it) from `@sentry/server-utils`. `getProviderMetadataAttributes`, still shared with the `ai` >= 7 tracing-channel subscriber, is kept. - vercel-edge: the `vercelAIIntegration` is removed entirely (no longer supported). - deno & cloudflare: use the server-utils `vercelAIIntegration` directly instead of wrapping it with the OTel processors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Removing `vercelAIIntegration` from `@sentry/vercel-edge` dropped it from the `@sentry/nextjs` edge build (which re-exports that package), so named imports from `@sentry/nextjs` would fail when Next.js compiles instrumentation for the edge runtime — while `index.types.ts` still declares the export. Mirror the existing `pinoIntegration` pattern: a no-op edge shim plus an explicit server re-export so the export is statically detectable from both builds. Extends the `serverExports` regression test to cover it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
f4fb222 to
640b46f
Compare
| instrumentStateGraph, | ||
| instrumentCreateReactAgent, | ||
| } from '@sentry/server-utils'; | ||
| export { vercelAIIntegration } from '@sentry/server-utils/orchestrion'; |
There was a problem hiding this comment.
Bug: The exported vercelAIIntegration for Cloudflare will fail if the nodejs_compat flag is not enabled, as it lacks a guard for the node:diagnostics_channel dependency.
Severity: HIGH
Suggested Fix
Add a guard in the orchestrion version of vercelAIIntegration (packages/server-utils/src/integrations/vercel-ai.ts) to check if dc.tracingChannel is available before using it, similar to the guard in the base integration. This will prevent crashes in environments without Node.js compatibility, like default Cloudflare Workers. Alternatively, do not export this integration from the @sentry/cloudflare package.
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/cloudflare/src/index.ts#L137
Potential issue: The `vercelAIIntegration` exported from `@sentry/cloudflare`
(re-exported from `@sentry/server-utils/orchestrion`) unconditionally imports and uses
`node:diagnostics_channel`. However, this module is only available in Cloudflare Workers
when the `nodejs_compat` compatibility flag is enabled. Unlike the base integration,
this version lacks a runtime guard to check for the existence of `dc.tracingChannel`.
Consequently, any Cloudflare user who uses this integration without enabling
`nodejs_compat` will experience a runtime error when the application attempts to load
the missing Node.js module.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
These need to go into docs/migration/v11-end-state.md I think
Add docs about vercel AI, based on #23384.

Removes the OpenTelemetry-span post-processing path for the Vercel AI SDK from
@sentry/server-utils—addVercelAiProcessorsand every helper reachable only through it (thespanStart/processSpan/event-processor pipeline, plus the now-orphanedutils.ts,constants.ts,types.ts, and theAI_*attribute constants).getProviderMetadataAttributesis kept, since theai>= 7 tracing-channel subscriber still shares it.Per-runtime handling of the
vercelAIIntegration:@sentry/nextjs.vercelAIIntegrationfrom@sentry/server-utils/orchestrion— the same integration Node uses and the one Deno's default set already registered.vercelAIIntegrationfrom@sentry/server-utils(its existing import source; Cloudflare has not yet moved to the orchestrion entry). It now uses the channel-based integration directly instead of wrapping it with the OTel processors.A migration note is added under the v11 "AI integrations" removed-APIs section, and
addVercelAiProcessorsis dropped from the "moved helpers" list there.Stacked on top of #23360 (the
vercelAiIntegration→vercelAIIntegrationrename).