Skip to content

wip fix(node): Actually check for ai require resolve to enforce the integraton#19188

Closed
RulaKhaled wants to merge 1 commit intodevelopfrom
resolve-cache-issue
Closed

wip fix(node): Actually check for ai require resolve to enforce the integraton#19188
RulaKhaled wants to merge 1 commit intodevelopfrom
resolve-cache-issue

Conversation

@RulaKhaled
Copy link
Member

@RulaKhaled RulaKhaled commented Feb 5, 2026

Vercel AI integration auto-detection was failing for vercel deployed Next.js 16 apps

During SDK init, shouldForceIntegration() checked for the 'ai' package by reading package.json from the filesystem
In serverless cold starts, filesystem wasn't ready yet → read failed silently → empty result cached
All subsequent checks returned the cached empty object → moduleList.ai always undefined → auto-detection broken

Solution:

  • Replaced filesystem-based detection with require.resolve('ai'):
  • No race conditions
  • Works in all environments
  • Less code :D

closes #19147

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Codecov Results 📊


Generated by Codecov Action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 11,636 - 8,919 +30%
GET With Sentry 1,914 16% 1,622 +18%
GET With Sentry (error only) 7,636 66% 5,826 +31%
POST Baseline 1,172 - 1,147 +2%
POST With Sentry 592 51% 554 +7%
POST With Sentry (error only) 1,013 86% 1,028 -1%
MYSQL Baseline 4,034 - 3,265 +24%
MYSQL With Sentry 494 12% 421 +17%
MYSQL With Sentry (error only) 3,281 81% 2,629 +25%

View base workflow run

@RulaKhaled RulaKhaled changed the title fix(node): Actually check for ai require resolve to enforce the integ… Fix auto-detection race condition in serverless environments Feb 5, 2026
@RulaKhaled RulaKhaled changed the title Fix auto-detection race condition in serverless environments fix(core): Fix auto-detection race condition in serverless environments Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.53 kB - -
@sentry/browser - with treeshaking flags 24.05 kB - -
@sentry/browser (incl. Tracing) 42.36 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.02 kB - -
@sentry/browser (incl. Tracing, Replay) 81.01 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.65 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 85.71 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.9 kB - -
@sentry/browser (incl. Feedback) 42.27 kB - -
@sentry/browser (incl. sendFeedback) 30.22 kB - -
@sentry/browser (incl. FeedbackAsync) 35.21 kB - -
@sentry/browser (incl. Metrics) 26.71 kB - -
@sentry/browser (incl. Logs) 26.85 kB - -
@sentry/browser (incl. Metrics & Logs) 27.53 kB - -
@sentry/react 27.3 kB - -
@sentry/react (incl. Tracing) 44.68 kB - -
@sentry/vue 29.98 kB - -
@sentry/vue (incl. Tracing) 44.2 kB - -
@sentry/svelte 25.55 kB - -
CDN Bundle 28.08 kB - -
CDN Bundle (incl. Tracing) 43.15 kB - -
CDN Bundle (incl. Logs, Metrics) 28.92 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 43.99 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 67.86 kB - -
CDN Bundle (incl. Tracing, Replay) 79.91 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 80.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 85.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.23 kB - -
CDN Bundle - uncompressed 82.12 kB - -
CDN Bundle (incl. Tracing) - uncompressed 127.83 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 84.95 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.33 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.43 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.25 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 260.04 kB - -
@sentry/nextjs (client) 47.02 kB +0.01% +1 B 🔺
@sentry/sveltekit (client) 42.78 kB - -
@sentry/node-core 52.19 kB -0.01% -1 B 🔽
@sentry/node 166.28 kB -0.01% -8 B 🔽
@sentry/node - without tracing 93.97 kB - -
@sentry/aws-serverless 109.47 kB +0.01% +1 B 🔺

View base workflow run

@RulaKhaled RulaKhaled changed the title fix(core): Fix auto-detection race condition in serverless environments fix(node): Actually check for ai require resolve to enforce the integraton Feb 5, 2026
@RulaKhaled RulaKhaled changed the title fix(node): Actually check for ai require resolve to enforce the integraton wip fix(node): Actually check for ai require resolve to enforce the integraton Feb 5, 2026
@RulaKhaled RulaKhaled closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vercelAIIntegration doesn't activate on Vercel deployments without force: true

1 participant