diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/app/layout.tsx b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/app/layout.tsx index 15c3b9789ee3..006a01fcfa76 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/app/layout.tsx +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/app/layout.tsx @@ -9,22 +9,34 @@ export default function Layout({ children }: { children: React.ReactNode }) {

Layout (/)

{children} diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts index 0e2eb7417cee..810e76eaa690 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts @@ -4,7 +4,9 @@ import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should create a transaction for edge routes', async ({ request }) => { const edgerouteTransactionPromise = waitForTransaction('nextjs-app-dir', async transactionEvent => { return ( - transactionEvent?.transaction === 'GET /api/edge-endpoint' && transactionEvent?.contexts?.trace?.status === 'ok' + transactionEvent?.transaction === 'GET /api/edge-endpoint' && + transactionEvent?.contexts?.trace?.status === 'ok' && + transactionEvent.contexts?.runtime?.name === 'vercel-edge' ); }); @@ -19,7 +21,6 @@ test('Should create a transaction for edge routes', async ({ request }) => { expect(edgerouteTransaction.contexts?.trace?.status).toBe('ok'); expect(edgerouteTransaction.contexts?.trace?.op).toBe('http.server'); - expect(edgerouteTransaction.contexts?.runtime?.name).toBe('vercel-edge'); expect(edgerouteTransaction.request?.headers?.['x-yeet']).toBe('test-value'); }); diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index ddf3668e27b3..168288e081fe 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -307,12 +307,6 @@ export function init(options: NodeOptions): NodeClient | undefined { if (typeof method === 'string' && typeof route === 'string') { event.transaction = `${method} ${route.replace(/\/route$/, '')}`; event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; - } else { - // If we cannot hoist the route (or rather parameterize the transaction) for BaseServer.handleRequest spans, - // we drop it because the chance that it is a low-quality transaction we don't want is pretty high. - // This is important in the case of edge-runtime where Next.js will also create unnecessary Node.js root - // spans, that are not parameterized. - return null; } }