Skip to content

fix(nuxt): Detect Nitro version via the app's Nuxt dependency chain - #24019

Merged
s1gr1d merged 2 commits into
developfrom
sig/fix-nitro-version-lookup
Sep 3, 2026
Merged

fix(nuxt): Detect Nitro version via the app's Nuxt dependency chain#24019
s1gr1d merged 2 commits into
developfrom
sig/fix-nitro-version-lookup

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Sep 3, 2026

Copy link
Copy Markdown
Member

In a monorepo where a nitro v3 package is resolvable above a Nitro-v2 Nuxt app, the SDK registers the Nitro v3 plugin variants and the app silently loses storage, database, and cache instrumentation.

Nitro v2 is published as nitropack, v3 as nitro. getNitroMajorVersion() asked local-pkg for any package named nitro with no anchor. Module resolution walks up the directory tree, so an unrelated nitro v3 higher up (for example a workspace-root devDependency) wins even though the app's Nuxt imports nitropack v2.

The fix follows the dependency chain Nuxt itself imports Nitro through: resolve nuxt from rootDir, hop to @nuxt/nitro-server when nuxt declares it (Nuxt >= 3.21), and only resolve nitro if that provider declares it. nitropack instead means v2:

  • Nuxt 3.x / 4.0–4.1: nuxtnitropack@2
  • Nuxt ≥4.2 stable: nuxt@nuxt/nitro-servernitropack@2
  • Nuxt 5 nightly: nuxt@nuxt/nitro-server(-nightly) → nitro@3

@s1gr1d
s1gr1d requested a review from a team as a code owner September 3, 2026 13:07
@s1gr1d
s1gr1d requested review from chargome and mydea and removed request for a team September 3, 2026 13:07
Comment thread packages/nuxt/src/vite/utils.ts
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.69 kB - -
@sentry/browser - with treeshaking flags 26.99 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.89 kB - -
@sentry/browser (incl. Tracing) 49.07 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 49.07 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.98 kB - -
@sentry/browser (incl. Tracing, Replay) 88.55 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.85 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.24 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.18 kB - -
@sentry/browser (incl. Feedback) 46.17 kB - -
@sentry/browser (incl. sendFeedback) 33.75 kB - -
@sentry/browser (incl. FeedbackAsync) 38.85 kB - -
@sentry/browser (incl. Metrics) 29.66 kB - -
@sentry/browser (incl. Logs) 29.94 kB - -
@sentry/browser (incl. Metrics & Logs) 30.59 kB - -
@sentry/react 30.45 kB - -
@sentry/react (incl. Tracing) 51.28 kB - -
@sentry/vue 35.91 kB - -
@sentry/vue (incl. Tracing) 51.34 kB - -
@sentry/svelte 28.71 kB - -
CDN Bundle 30.43 kB - -
CDN Bundle (incl. Tracing) 49.6 kB - -
CDN Bundle (incl. Logs, Metrics) 32.66 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.53 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.25 kB - -
CDN Bundle (incl. Tracing, Replay) 87.1 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 93.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.97 kB - -
CDN Bundle - uncompressed 90.13 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.81 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.52 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.59 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.68 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.3 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.76 kB - -
@sentry/nextjs (client) 53.89 kB - -
@sentry/sveltekit (client) 49.51 kB - -
@sentry/core/server 40.96 kB - -
@sentry/core/browser 13.53 kB - -
@sentry/node 124.66 kB +0.02% +21 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.51 kB - -
@sentry/node - without tracing 88.5 kB +0.03% +23 B 🔺
@sentry/node - without channel injection 103.95 kB +0.03% +21 B 🔺
@sentry/aws-serverless 96.87 kB +0.03% +23 B 🔺
@sentry/cloudflare (withSentry) - minified 201.56 kB - -
@sentry/cloudflare (withSentry) 501.37 kB - -

View base workflow run

@s1gr1d
s1gr1d merged commit fc00ed6 into develop Sep 3, 2026
151 of 154 checks passed
@s1gr1d
s1gr1d deleted the sig/fix-nitro-version-lookup branch September 3, 2026 15:37
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.

2 participants