diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/.gitignore b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/.gitignore deleted file mode 100644 index 4a7f73a2ed0d..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Nuxt dev/build outputs -.output -.data -.nuxt -.nitro -.cache -dist - -# Node dependencies -node_modules - -# Logs -logs -*.log - -# Misc -.DS_Store -.fleet -.idea - -# Local env files -.env -.env.* -!.env.example diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/app/app.vue b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/app/app.vue deleted file mode 100644 index 09f935bbb637..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/app/app.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/nuxt.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/nuxt.config.ts deleted file mode 100644 index 8e7b7a15eedb..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/nuxt.config.ts +++ /dev/null @@ -1,22 +0,0 @@ -// https://nuxt.com/docs/api/configuration/nuxt-config -export default defineNuxtConfig({ - compatibilityDate: '2025-07-15', - devtools: { enabled: true }, - - modules: ['@sentry/nuxt/module'], - - sentry: { - _experimental: { - useDiagnosticsChannelInjection: true, - }, - autoInjectServerSentry: 'top-level-import', - }, - - runtimeConfig: { - public: { - sentry: { - dsn: 'https://public@dsn.ingest.sentry.io/1337', - }, - }, - }, -}); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/package.json b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/package.json deleted file mode 100644 index ca4c3a887d9b..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "nuxt-4-orchestrion", - "type": "module", - "private": true, - "scripts": { - "build": "nuxt build", - "dev": "nuxt dev", - "generate": "nuxt generate", - "preview": "nuxt preview", - "start": "node .output/server/index.mjs", - "clean": "npx nuxi cleanup", - "test": "playwright test", - "test:prod": "TEST_ENV=production playwright test", - "test:build": "pnpm install && pnpm build", - "test:build-canary": "pnpm add nuxt@npm:nuxt-nightly@latest && pnpm add nitropack@npm:nitropack-nightly@latest && pnpm install --force && pnpm build", - "test:assert": "pnpm test:prod" - }, - "//": "Need to use ioredis 5.10.1 because that's the last version before they support tracing channels", - "dependencies": { - "@sentry/nuxt": "file:../../packed/sentry-nuxt-packed.tgz", - "ioredis": "5.10.1", - "mysql": "^2.18.1", - "nuxt": "^4.4.8", - "vue": "^3.5.38", - "vue-router": "^5.1.0" - }, - "devDependencies": { - "@playwright/test": "~1.56.0", - "@sentry-internal/test-utils": "link:../../../test-utils" - }, - "volta": { - "extends": "../../package.json", - "node": "22.20.0" - } -} diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/playwright.config.ts deleted file mode 100644 index 047fc701fa50..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/playwright.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { getPlaywrightConfig } from '@sentry-internal/test-utils'; - -const config = getPlaywrightConfig({ - startCommand: 'pnpm start', -}); - -export default { - ...config, - globalSetup: './global-setup.mjs', - globalTeardown: './global-teardown.mjs', -}; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/public/favicon.ico b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/public/favicon.ico deleted file mode 100644 index 18993ad91cfd..000000000000 Binary files a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/public/favicon.ico and /dev/null differ diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/public/robots.txt b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/public/robots.txt deleted file mode 100644 index 0ad279c73692..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-Agent: * -Disallow: diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/sentry.client.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/sentry.client.config.ts deleted file mode 100644 index ddbbd2581536..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/sentry.client.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as Sentry from '@sentry/nuxt'; -import { useRuntimeConfig } from '#imports'; - -Sentry.init({ - traceLifecycle: 'static', - dsn: useRuntimeConfig().public.sentry.dsn, - tunnel: 'http://localhost:3031/', // proxy server - tracesSampleRate: 1.0, -}); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/sentry.server.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/sentry.server.config.ts deleted file mode 100644 index f44852a22d7f..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/sentry.server.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as Sentry from '@sentry/nuxt'; - -// The Nuxt module transforms supported Nitro dependencies when enabled in `nuxt.config.ts`. -Sentry.init({ - traceLifecycle: 'static', - dsn: 'https://public@dsn.ingest.sentry.io/1337', - tracesSampleRate: 1.0, - tunnel: 'http://localhost:3031/', // proxy server -}); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/start-event-proxy.mjs deleted file mode 100644 index 68e43bd9598c..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/start-event-proxy.mjs +++ /dev/null @@ -1,6 +0,0 @@ -import { startEventProxyServer } from '@sentry-internal/test-utils'; - -startEventProxyServer({ - port: 3031, - proxyServerName: 'nuxt-4-orchestrion', -}); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tsconfig.json b/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tsconfig.json deleted file mode 100644 index 307b2134b94b..000000000000 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - // https://nuxt.com/docs/guide/concepts/typescript - "files": [], - "references": [ - { - "path": "./.nuxt/tsconfig.app.json" - }, - { - "path": "./.nuxt/tsconfig.server.json" - }, - { - "path": "./.nuxt/tsconfig.shared.json" - }, - { - "path": "./.nuxt/tsconfig.node.json" - } - ] -} diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/docker-compose.yml b/dev-packages/e2e-tests/test-applications/nuxt-4/docker-compose.yml similarity index 86% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/docker-compose.yml rename to dev-packages/e2e-tests/test-applications/nuxt-4/docker-compose.yml index f8191b69acad..a50a0097e5ae 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/docker-compose.yml +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/docker-compose.yml @@ -2,7 +2,7 @@ services: db: image: mysql:8.0 restart: always - container_name: e2e-tests-nuxt-4-orchestrion-mysql + container_name: e2e-tests-nuxt-4-mysql # The `mysql` 2.x driver doesn't speak MySQL 8's default # `caching_sha2_password` auth, so force the legacy plugin. command: ['--default-authentication-plugin=mysql_native_password'] @@ -20,7 +20,7 @@ services: redis: image: redis:7 restart: always - container_name: e2e-tests-nuxt-4-orchestrion-redis + container_name: e2e-tests-nuxt-4-redis ports: - '6379:6379' healthcheck: diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/global-setup.mjs b/dev-packages/e2e-tests/test-applications/nuxt-4/global-setup.mjs similarity index 67% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/global-setup.mjs rename to dev-packages/e2e-tests/test-applications/nuxt-4/global-setup.mjs index 634e34824a2f..cb48d539c466 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/global-setup.mjs +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/global-setup.mjs @@ -5,8 +5,8 @@ import { fileURLToPath } from 'url'; const __dirname = dirname(fileURLToPath(import.meta.url)); export default async function globalSetup() { - // Start MySQL via Docker Compose. `--wait` blocks until the healthcheck - // in docker-compose.yml passes, so the app can connect immediately. + // Start MySQL + Redis via Docker Compose. `--wait` blocks until the + // healthchecks in docker-compose.yml pass, so the app can connect immediately. execSync('docker compose up -d --wait', { cwd: __dirname, stdio: 'inherit', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/global-teardown.mjs b/dev-packages/e2e-tests/test-applications/nuxt-4/global-teardown.mjs similarity index 100% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/global-teardown.mjs rename to dev-packages/e2e-tests/test-applications/nuxt-4/global-teardown.mjs diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/package.json b/dev-packages/e2e-tests/test-applications/nuxt-4/package.json index 02477111483d..e66ce2bd3610 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/package.json @@ -20,6 +20,8 @@ "dependencies": { "@pinia/nuxt": "^0.5.5", "@sentry/nuxt": "file:../../packed/sentry-nuxt-packed.tgz", + "ioredis": "5.10.1", + "mysql": "^2.18.1", "nuxt": "^4.1.2" }, "devDependencies": { diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts index b86690ca086c..0b61db7cde11 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts @@ -22,4 +22,8 @@ const config = getPlaywrightConfig({ startCommand: getStartCommand(), }); -export default config; +export default { + ...config, + globalSetup: './global-setup.mjs', + globalTeardown: './global-teardown.mjs', +}; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/server/api/db-ioredis.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/server/api/db-ioredis.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/server/api/db-ioredis.ts rename to dev-packages/e2e-tests/test-applications/nuxt-4/server/api/db-ioredis.ts diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/server/api/db-mysql.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/server/api/db-mysql.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/server/api/db-mysql.ts rename to dev-packages/e2e-tests/test-applications/nuxt-4/server/api/db-mysql.ts diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tests/build-injection.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/build-injection.test.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tests/build-injection.test.ts rename to dev-packages/e2e-tests/test-applications/nuxt-4/tests/build-injection.test.ts diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tests/db.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/db-drivers.test.ts similarity index 85% rename from dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tests/db.test.ts rename to dev-packages/e2e-tests/test-applications/nuxt-4/tests/db-drivers.test.ts index 0e5d5c41bdd6..464850a116dd 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-orchestrion/tests/db.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/db-drivers.test.ts @@ -1,8 +1,12 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; +// The Nuxt module auto-wires the orchestrion build-time transform, which injects +// `diagnostics_channel` publishers into these drivers as Nitro bundles them. That +// only happens in the production build, so these tests are excluded from the +// `test:dev` pass (which filters to `environment`). test('Instruments ioredis automatically', async ({ baseURL }) => { - const transactionEventPromise = waitForTransaction('nuxt-4-orchestrion', transactionEvent => { + const transactionEventPromise = waitForTransaction('nuxt-4', transactionEvent => { return ( transactionEvent.contexts?.trace?.op === 'http.server' && transactionEvent.transaction === 'GET /api/db-ioredis' ); @@ -46,7 +50,7 @@ test('Instruments ioredis automatically', async ({ baseURL }) => { }); test('Instruments mysql automatically', async ({ baseURL }) => { - const transactionEventPromise = waitForTransaction('nuxt-4-orchestrion', transactionEvent => { + const transactionEventPromise = waitForTransaction('nuxt-4', transactionEvent => { return ( transactionEvent.contexts?.trace?.op === 'http.server' && transactionEvent.transaction === 'GET /api/db-mysql' ); diff --git a/packages/nuxt/src/common/types.ts b/packages/nuxt/src/common/types.ts index afcf0a327d52..9bd61aece2cc 100644 --- a/packages/nuxt/src/common/types.ts +++ b/packages/nuxt/src/common/types.ts @@ -183,23 +183,6 @@ export type SentryNuxtModuleOptions = BuildTimeOptionsBase & { */ enabled?: boolean; - // todo(v11): Update this JSDoc (and remove from experimental) - /** - * Experimental build-time options that may change or be removed without notice. - */ - _experimental?: { - /** - * Enables build-time diagnostics-channel instrumentation for supported dependencies bundled into the Nitro server. - * - * 1. Remove `--import ./.output/server/sentry.server.config.mjs` from your `start` script - * 2. Add `sentry.autoInjectServerSentry: 'top-level-import'` in `nuxt.config.ts` so Sentry's server configuration is automatically imported - * - * @default false - * @experimental May change or be removed in any release. - */ - useDiagnosticsChannelInjection?: boolean; - }; - /** * Options for the Sentry Vite plugin to customize the source maps upload process. * diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index 4cf39d16cdbc..fd3e874d214d 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -85,9 +85,7 @@ export default defineNuxtModule({ const isMinNuxtV4 = nuxtMajor >= 4; if (serverConfigFile) { - if (moduleOptions._experimental?.useDiagnosticsChannelInjection) { - setupOrchestrion(nuxt); - } + setupOrchestrion(nuxt, moduleOptions.buildTimeInstrumentation); if (isNitroV3) { addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/handler.server')); diff --git a/packages/nuxt/src/vite/orchestrion.ts b/packages/nuxt/src/vite/orchestrion.ts index 5bc3d3be1a12..db367e295c59 100644 --- a/packages/nuxt/src/vite/orchestrion.ts +++ b/packages/nuxt/src/vite/orchestrion.ts @@ -11,7 +11,11 @@ const IORedisDependencies = ['standard-as-callback']; * Configures Nitro to bundle and transform dependencies that publish tracing * events through diagnostics channels. */ -export function setupOrchestrion(nuxt: Nuxt): void { +export function setupOrchestrion(nuxt: Nuxt, buildTimeInstrumentation?: boolean): void { + if (buildTimeInstrumentation === false) { + return; + } + nuxt.hook('nitro:config', (nitroConfig: NitroConfig) => { if (nuxt.options?._prepare) { return; diff --git a/packages/nuxt/test/vite/buildOptions.test-d.ts b/packages/nuxt/test/vite/buildOptions.test-d.ts index 0eca417d46f0..123a55be5239 100644 --- a/packages/nuxt/test/vite/buildOptions.test-d.ts +++ b/packages/nuxt/test/vite/buildOptions.test-d.ts @@ -51,12 +51,10 @@ describe('Sentry Nuxt build-time options type', () => { excludeReplayIframe: true, excludeReplayWorker: true, }, + buildTimeInstrumentation: false, // --- SentryNuxtModuleOptions specific options --- enabled: true, - _experimental: { - useDiagnosticsChannelInjection: true, - }, autoInjectServerSentry: 'experimental_dynamic-import', configDir: '~/custom-config', experimental_entrypointWrappedFunctions: ['default', 'handler', 'server', 'customExport'], diff --git a/packages/nuxt/test/vite/orchestrion.test.ts b/packages/nuxt/test/vite/orchestrion.test.ts index 1d0f8d105627..4b1a79fce4b0 100644 --- a/packages/nuxt/test/vite/orchestrion.test.ts +++ b/packages/nuxt/test/vite/orchestrion.test.ts @@ -70,6 +70,18 @@ describe('setupOrchestrion', () => { }); }); + it('does not change Nitro configuration when `buildTimeInstrumentation` is `false`', async () => { + const { setupOrchestrion } = await import('../../src/vite/orchestrion'); + const mockNuxt = createMockNuxt(); + const nitroConfig = {}; + + setupOrchestrion(mockNuxt as unknown as Nuxt, false); + await mockNuxt.triggerHook('nitro:config', nitroConfig); + + expect(mockSentryOrchestrionPlugin).not.toHaveBeenCalled(); + expect(nitroConfig).toEqual({}); + }); + it('does not change Nitro configuration in prepare mode', async () => { const { setupOrchestrion } = await import('../../src/vite/orchestrion'); const mockNuxt = createMockNuxt({ _prepare: true });