Repository navigation
test(nuxt): Move tunnel e2e tests into dedicated nuxt tunnel apps #26393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
a4157cb
test(nuxt): Add a dedicated nuxt-4-tunnel e2e app
sentry-junior[bot] c5f2d21
test(nuxt): Add nuxt-5-tunnel and remove the legacy nuxt tunnel variants
sentry-junior[bot] 50ac2fb
test(nuxt): Drop the Node server config from the Cloudflare tunnel va…
sentry-junior[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
dev-packages/e2e-tests/test-applications/nuxt-4-cloudflare/server/api/anchor.ts
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
dev-packages/e2e-tests/test-applications/nuxt-4-cloudflare/server/api/post-error.ts
This file was deleted.
Oops, something went wrong.
7 changes: 1 addition & 6 deletions
7
dev-packages/e2e-tests/test-applications/nuxt-4-cloudflare/server/plugins/sentry.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,10 @@ | ||
| import { defineNitroPlugin } from '#imports'; | ||
| import { serveTunnelIntegration } from '@sentry/cloudflare'; | ||
| import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins'; | ||
|
|
||
| declare const __E2E_TEST_TUNNEL__: boolean; | ||
|
|
||
| export default defineNitroPlugin( | ||
| sentryCloudflareNitroPlugin({ | ||
| // The tunnel forwards to the DSN host, which is the event proxy in the tunnel variant. | ||
| dsn: __E2E_TEST_TUNNEL__ ? 'http://public@localhost:3031/1337' : 'https://public@dsn.ingest.sentry.io/1337', | ||
| dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
| tracesSampleRate: 1.0, | ||
| tunnel: 'http://localhost:3031/', // proxy server | ||
| integrations: __E2E_TEST_TUNNEL__ ? [serveTunnelIntegration()] : [], | ||
| }), | ||
| ); |
14 changes: 0 additions & 14 deletions
14
dev-packages/e2e-tests/test-applications/nuxt-4-cloudflare/tests/tunnel-request-body.test.ts
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
dev-packages/e2e-tests/test-applications/nuxt-4-cloudflare/tests/tunnel.test.ts
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/app/app.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <template> | ||
| <h1>Nuxt Tunnel E2E Test</h1> | ||
| </template> |
16 changes: 16 additions & 0 deletions
16
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/nuxt.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export default defineNuxtConfig({ | ||
| compatibilityDate: '2025-06-06', | ||
| modules: ['@sentry/nuxt/module'], | ||
| app: { baseURL: '/app/' }, | ||
| // A headers rule on every path, like a security headers setup, also covers the tunnel's path. | ||
| routeRules: { '/**': { headers: { 'x-e2e-route-rule': '1' } } }, | ||
| nitro: | ||
| process.env.RUNTIME === 'cloudflare' | ||
| ? { | ||
| preset: 'cloudflare_module', | ||
| cloudflare: { nodeCompat: true, deployConfig: false }, | ||
| // Cloudflare has no server config file, the SDK is set up by this plugin. | ||
| plugins: ['~~/server/sentry-cloudflare.ts'], | ||
| } | ||
| : {}, | ||
| }); |
33 changes: 33 additions & 0 deletions
33
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "name": "nuxt-4-tunnel", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "nuxt build", | ||
| "start": "node .output/server/index.mjs", | ||
| "start:cloudflare": "wrangler dev --port 3030", | ||
| "clean": "npx nuxi cleanup", | ||
| "test:build": "pnpm install && pnpm build", | ||
| "test:assert": "TEST_ENV=production playwright test && TEST_ENV=development playwright test" | ||
| }, | ||
| "dependencies": { | ||
| "@sentry/cloudflare": "file:../../packed/sentry-cloudflare-packed.tgz", | ||
| "@sentry/nuxt": "file:../../packed/sentry-nuxt-packed.tgz", | ||
| "nuxt": "^4.6.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@playwright/test": "1.64.1", | ||
| "@sentry-internal/test-utils": "file:../../packed/sentry-internal-test-utils-packed.tgz", | ||
| "wrangler": "^4.72.0" | ||
| }, | ||
| "sentryTest": { | ||
| "variants": [ | ||
| { | ||
| "runtime": "cloudflare", | ||
| "build-command": "rm sentry.server.config.ts && pnpm test:build", | ||
| "assert-command": "TEST_ENV=production pnpm exec playwright test", | ||
| "label": "nuxt-4-tunnel (cloudflare)" | ||
| } | ||
| ] | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/playwright.config.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { getPlaywrightConfig, getRuntime } from '@sentry-internal/test-utils'; | ||
|
|
||
| export default getPlaywrightConfig({ | ||
| startCommand: | ||
| process.env.TEST_ENV === 'development' | ||
| ? 'pnpm exec nuxt dev -p 3030' | ||
| : getRuntime() === 'cloudflare' | ||
| ? 'pnpm start:cloudflare' | ||
| : 'pnpm start', | ||
| }); |
4 changes: 4 additions & 0 deletions
4
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/pnpm-workspace.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| allowBuilds: | ||
| esbuild: true | ||
| workerd: true | ||
| minimumReleaseAge: 0 |
8 changes: 8 additions & 0 deletions
8
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/sentry.client.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import * as Sentry from '@sentry/nuxt'; | ||
|
|
||
| Sentry.init({ | ||
| dsn: 'http://public@localhost:3031/1337', | ||
| tunnel: true, | ||
| integrations: [Sentry.browserTracingIntegration()], | ||
| tracesSampleRate: 1, | ||
| }); |
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/sentry.server.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import * as Sentry from '@sentry/nuxt'; | ||
|
|
||
| Sentry.init({ | ||
| dsn: 'http://public@localhost:3031/1337', | ||
| integrations: [Sentry.serveTunnelIntegration()], | ||
| tracesSampleRate: 1, | ||
| }); | ||
3 changes: 3 additions & 0 deletions
3
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/server/api/anchor.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { defineEventHandler } from '#imports'; | ||
|
|
||
| export default defineEventHandler(() => ({ ok: true })); |
5 changes: 5 additions & 0 deletions
5
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/server/api/error.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { defineEventHandler } from '#imports'; | ||
|
|
||
| export default defineEventHandler(() => { | ||
| throw new Error('Tunnel test error'); | ||
| }); |
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/server/middleware/auth.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { createError, defineEventHandler, getHeader } from '#imports'; | ||
|
|
||
| export default defineEventHandler(event => { | ||
| if (event.method === 'POST' && getHeader(event, 'x-auth') !== 'ok') { | ||
| throw createError({ statusCode: 401, statusMessage: 'blocked by user auth' }); | ||
| } | ||
| }); |
11 changes: 11 additions & 0 deletions
11
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/server/sentry-cloudflare.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { defineNitroPlugin } from '#imports'; | ||
| import { serveTunnelIntegration } from '@sentry/cloudflare'; | ||
| import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins'; | ||
|
|
||
| export default defineNitroPlugin( | ||
| sentryCloudflareNitroPlugin({ | ||
| dsn: 'http://public@localhost:3031/1337', | ||
| integrations: [serveTunnelIntegration()], | ||
| tracesSampleRate: 1, | ||
| }), | ||
| ); |
6 changes: 6 additions & 0 deletions
6
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/start-event-proxy.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { startEventProxyServer } from '@sentry-internal/test-utils'; | ||
|
|
||
| startEventProxyServer({ | ||
| port: 3031, | ||
| proxyServerName: 'nuxt-4-tunnel', | ||
| }); |
16 changes: 16 additions & 0 deletions
16
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/tests/request-body.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { getRuntime, waitForError } from '@sentry-internal/test-utils'; | ||
|
|
||
| test('keeps the body of a request that is not a tunnel request off its error event', async ({ request }) => { | ||
| test.skip(getRuntime() !== 'cloudflare', 'Only the Cloudflare plugin decides which request bodies it passes on'); | ||
| const errorPromise = waitForError( | ||
| 'nuxt-4-tunnel', | ||
| event => event.exception?.values?.[0]?.value === 'Tunnel test error', | ||
| ); | ||
|
|
||
| await request.post('/app/api/error', { data: { note: 'stays off the event' }, headers: { 'x-auth': 'ok' } }); | ||
| const error = await errorPromise; | ||
|
|
||
| expect(error.request?.method).toBe('POST'); | ||
| expect(error.request?.data).toBeUndefined(); | ||
| }); |
14 changes: 14 additions & 0 deletions
14
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/tests/tunnel.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { getRuntime } from '@sentry-internal/test-utils'; | ||
| import { runManagedTunnelSuite } from '@sentry-internal/test-utils/tunnel-suite'; | ||
|
|
||
| // On Nitro v2, `sentryCloudflareNitroPlugin` checks for a tunnel request before the SDK has a client, so it never | ||
| // passes the request body on and the app answers the tunnel instead. | ||
| test.fixme(getRuntime() === 'cloudflare', 'The managed tunnel is not served on Cloudflare yet'); | ||
|
|
||
| test.beforeAll(async ({ request }) => { | ||
| // `nuxt dev` opens the port before it's ready and answers 503 until then, and Playwright only waits for the port. | ||
| await expect.poll(async () => (await request.get('/app/')).status(), { timeout: 30_000 }).not.toBe(503); | ||
| }); | ||
|
|
||
| runManagedTunnelSuite({ appName: 'nuxt-4-tunnel', basePath: '/app' }); |
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/nuxt-4-tunnel/wrangler.jsonc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "name": "nuxt-4-tunnel", | ||
| "main": "./.output/server/index.mjs", | ||
| "compatibility_date": "2026-06-29", | ||
| "compatibility_flags": ["nodejs_compat"], | ||
| "assets": { "directory": "./.output/public", "binding": "ASSETS" }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
dev-packages/e2e-tests/test-applications/nuxt-4/sentry.server.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,9 @@ | ||
| import * as Sentry from '@sentry/nuxt'; | ||
|
|
||
| Sentry.init({ | ||
| dsn: process.env.E2E_TEST_TUNNEL ? 'http://public@localhost:3031/1337' : 'https://public@dsn.ingest.sentry.io/1337', | ||
| dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
| tracesSampleRate: 1.0, // Capture 100% of the transactions | ||
| tunnel: 'http://localhost:3031/', // proxy server | ||
| // Several tests trigger the same server error one after another, which Dedupe would drop. | ||
| integrations: integrations => [ | ||
| ...integrations.filter(integration => integration.name !== 'Dedupe'), | ||
| ...(process.env.E2E_TEST_TUNNEL ? [Sentry.serveTunnelIntegration()] : []), | ||
| ], | ||
| integrations: integrations => [...integrations.filter(integration => integration.name !== 'Dedupe')], | ||
| }); |
7 changes: 1 addition & 6 deletions
7
dev-packages/e2e-tests/test-applications/nuxt-4/server/middleware/03.auth.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.