Title: vercelAIIntegration doesn't activate on Vercel deployments without force: true · Issue #19147 · getsentry/sentry-javascript · GitHub
Open Graph Title: vercelAIIntegration doesn't activate on Vercel deployments without force: true · Issue #19147 · getsentry/sentry-javascript
X Title: vercelAIIntegration doesn't activate on Vercel deployments without force: true · Issue #19147 · getsentry/sentry-javascript
Description: Problem The vercelAIIntegration in @sentry/nextjs doesn't activate on Vercel deployments, causing AI SDK spans to have incorrect names: On Vercel: Raw span names like ai.toolCall, ai.streamText (WRONG) Locally: Transformed names like gen...
Open Graph Description: Problem The vercelAIIntegration in @sentry/nextjs doesn't activate on Vercel deployments, causing AI SDK spans to have incorrect names: On Vercel: Raw span names like ai.toolCall, ai.streamText (WR...
X Description: Problem The vercelAIIntegration in @sentry/nextjs doesn't activate on Vercel deployments, causing AI SDK spans to have incorrect names: On Vercel: Raw span names like ai.toolCall, ai.streamText...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/19147
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vercelAIIntegration doesn't activate on Vercel deployments without force: true","articleBody":"## Problem\n\nThe `vercelAIIntegration` in `@sentry/nextjs` doesn't activate on Vercel deployments, causing AI SDK spans to have incorrect names:\n\n- **On Vercel**: Raw span names like `ai.toolCall`, `ai.streamText` (WRONG)\n- **Locally**: Transformed names like `gen_ai.execute_tool`, `gen_ai.stream_text` (CORRECT)\n\n## Root Cause\n\nThe Node SDK's `vercelAIIntegration` has conditional activation logic in `afterAllSetup`:\n\n```typescript\n// packages/node/src/integrations/tracing/vercelai/index.ts:28-37\nafterAllSetup(client) {\n const shouldForce = options.force ?? shouldForceIntegration(client);\n\n if (shouldForce) {\n addVercelAiProcessors(client); // ← Span transformation enabled\n } else {\n instrumentation?.callWhenPatched(() => addVercelAiProcessors(client));\n }\n}\n```\n\n`addVercelAiProcessors` is only called if:\n1. `force: true` is passed, OR\n2. Module detection succeeds (CJS mode only), OR \n3. OTEL successfully patches the `ai` module\n\n### Why It Fails on Vercel\n\nThe `ai` package is intentionally NOT externalized in Next.js builds:\n\n```typescript\n// packages/nextjs/src/config/withSentryConfig/constants.ts:5-8\n// NOTE: 'ai' (Vercel AI SDK) is intentionally NOT included in this list.\n// When externalized, Next.js doesn't properly handle the package's conditional exports,\n// specifically the \"react-server\" export condition.\n```\n\nBecause `ai` is bundled (not externalized):\n- OTEL's require hooks can't intercept module loading\n- `instrumentation?.callWhenPatched()` callback never fires\n- Module detection via `shouldForceIntegration` fails (requires CJS mode)\n- **Result**: `addVercelAiProcessors()` is never called on Vercel\n\n### Comparison: Edge vs Node Implementation\n\n**Edge implementation** (`vercel-edge/src/integrations/tracing/vercelai.ts`):\n```typescript\nsetup(client) {\n addVercelAiProcessors(client); // ALWAYS called unconditionally\n}\n```\n\n**Node implementation** - conditional, requires `force: true` to guarantee activation in bundled environments.\n\n## Current Workaround\n\nUsers must explicitly add `force: true` in their server config:\n\n```typescript\n// sentry.server.config.ts\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"...\",\n integrations: [Sentry.vercelAIIntegration({ force: true })],\n});\n```\n\n## Suggested Fix\n\nConsider one of these approaches:\n\n1. **Auto-detect Vercel environment**: Default `force: true` when `VERCEL` env var is present\n2. **Document the workaround**: Add clear documentation that `force: true` is required for Vercel deployments\n3. **Change default behavior**: Make the Node implementation behave like Edge (always register processors)\n\n## Environment\n\n- `@sentry/nextjs`: Latest\n- Deployment: Vercel (serverless)\n- AI SDK: `ai` package from Vercel","author":{"url":"https://github.com/sergical","@type":"Person","name":"sergical"},"datePublished":"2026-02-03T19:14:44Z","url":"https://github.com/getsentry/sentry-javascript/issues/19147"}
| 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:9ebd9875-ffe3-1485-d9ee-776da49587eb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9D4:383DB3:2C0D:3A33:6B0426FA |
| html-safe-nonce | 024695f7a1be14be6effb10adf62cdad7a7a9cfa6ef3a2f76d1b0850a3276168 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUQ0OjM4M0RCMzoyQzBEOjNBMzM6NkIwNDI2RkEiLCJ2aXNpdG9yX2lkIjoiNjk4Mjg1ODg0OTI2MzAzNjE1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0e9930722a6b1f98d560f99fe0fa4de35ef91e6aafbb544d7897f092ea9c2251 |
| hovercard-subject-tag | issue:3892769458 |
| 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/19147/issue_layout |
| twitter:image | https://opengraph.githubassets.com/25b7324ef99b7fcf8a31f53500112e71e8abc97ec432d505c9ebc02fc5377362/getsentry/sentry-javascript/issues/19147 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/25b7324ef99b7fcf8a31f53500112e71e8abc97ec432d505c9ebc02fc5377362/getsentry/sentry-javascript/issues/19147 |
| og:image:alt | Problem The vercelAIIntegration in @sentry/nextjs doesn't activate on Vercel deployments, causing AI SDK spans to have incorrect names: On Vercel: Raw span names like ai.toolCall, ai.streamText (WR... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sergical |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| 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 | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | canary-1 |
| 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