From 52e18fe943c7ea6632621b17b35dd3ae7d220569 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Thu, 31 Jul 2025 11:19:41 +0200 Subject: [PATCH 1/8] ref(nextjs): Add more specific `mechanism`s to captured errors --- packages/nextjs/src/common/captureRequestError.ts | 1 + .../src/common/pages-router-instrumentation/_error.ts | 2 +- .../wrapApiHandlerWithSentry.ts | 2 +- .../wrapPageComponentWithSentry.ts | 2 ++ packages/nextjs/src/common/utils/wrapperUtils.ts | 8 ++++++-- .../nextjs/src/common/withServerActionInstrumentation.ts | 1 + .../nextjs/src/common/wrapGenerationFunctionWithSentry.ts | 4 ++++ packages/nextjs/src/common/wrapMiddlewareWithSentry.ts | 2 +- packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts | 1 + .../nextjs/src/common/wrapServerComponentWithSentry.ts | 1 + packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts | 2 +- 11 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/nextjs/src/common/captureRequestError.ts b/packages/nextjs/src/common/captureRequestError.ts index fec9d46d0e65..cf24403c10da 100644 --- a/packages/nextjs/src/common/captureRequestError.ts +++ b/packages/nextjs/src/common/captureRequestError.ts @@ -38,6 +38,7 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC captureException(error, { mechanism: { handled: false, + type: 'nextjs.onRequestError', }, }); diff --git a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts index b33c648839fa..b6b4bd109527 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts @@ -45,7 +45,7 @@ export async function captureUnderscoreErrorException(contextOrProps: ContextOrP // is what passing a string to `captureException` will wind up doing) captureException(err || `_error.js called with falsy error (${err})`, { mechanism: { - type: 'instrument', + type: 'nextjs._error', handled: false, data: { function: '_error.getInitialProps', diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts index a0e4112404cd..058e53174441 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts @@ -112,7 +112,7 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz captureException(objectifiedErr, { mechanism: { - type: 'instrument', + type: 'nextjs.api', handled: false, data: { wrapped_handler: wrappingTarget.name, diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts index b08bdad5e9ab..ea11710ca74a 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts @@ -48,6 +48,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C captureException(e, { mechanism: { handled: false, + type: 'nextjs.page.class', }, }); throw e; @@ -77,6 +78,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C captureException(e, { mechanism: { handled: false, + type: 'nextjs.page.function', }, }); throw e; diff --git a/packages/nextjs/src/common/utils/wrapperUtils.ts b/packages/nextjs/src/common/utils/wrapperUtils.ts index 23b960c857cf..3661e7ce3445 100644 --- a/packages/nextjs/src/common/utils/wrapperUtils.ts +++ b/packages/nextjs/src/common/utils/wrapperUtils.ts @@ -25,7 +25,11 @@ export function withErrorInstrumentation any>( return await origFunction.apply(this, origFunctionArguments); } catch (e) { // TODO: Extract error logic from `withSentry` in here or create a new wrapper with said logic or something like that. - captureException(e, { mechanism: { handled: false } }); + captureException(e, { + // TODO: check if origFunction.name actually returns the correct name or minified garbage + // in this case, we can add another argument to this wrapper with the respective function name + mechanism: { handled: false, type: 'nextjs.wrapped', data: { function: origFunction.name } }, + }); throw e; } }; @@ -99,7 +103,7 @@ export async function callDataFetcherTraced Promis try { return await origFunction(...origFunctionArgs); } catch (e) { - captureException(e, { mechanism: { handled: false } }); + captureException(e, { mechanism: { handled: false, type: 'nextjs' } }); throw e; } } diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index e3cc2831d5e4..39af5a46bfcb 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -130,6 +130,7 @@ async function withServerActionInstrumentationImplementation a captureException(err, { mechanism: { handled: false, + type: 'nextjs.generation-function', + data: { + function: generationFunctionIdentifier, + }, }, }); } diff --git a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts index bd84fb4195b7..5fc0384d2880 100644 --- a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts +++ b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts @@ -108,7 +108,7 @@ export function wrapMiddlewareWithSentry( error => { captureException(error, { mechanism: { - type: 'instrument', + type: 'nextjs.middleware', handled: false, }, }); diff --git a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts index e10d51321a0e..fc2448d05722 100644 --- a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts @@ -96,6 +96,7 @@ export function wrapRouteHandlerWithSentry any>( captureException(error, { mechanism: { handled: false, + type: 'nextjs.route-handler', }, }); } diff --git a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts index f0f8e9df8717..e951b44769ef 100644 --- a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts +++ b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts @@ -136,6 +136,7 @@ export function wrapServerComponentWithSentry any> captureException(error, { mechanism: { handled: false, + type: 'nextjs.server-component', }, }); } diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index 6002981cfcf4..eb8baa3b172c 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -89,7 +89,7 @@ export function wrapApiHandlerWithSentry( error => { captureException(error, { mechanism: { - type: 'instrument', + type: 'nextjs.edge.api', handled: false, }, }); From d31eaf8bd13afac993586054eaaf652d019d18db Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 5 Sep 2025 17:13:22 +0200 Subject: [PATCH 2/8] adjust to trace origin scheme --- packages/nextjs/src/common/captureRequestError.ts | 2 +- .../nextjs/src/common/pages-router-instrumentation/_error.ts | 2 +- .../pages-router-instrumentation/wrapApiHandlerWithSentry.ts | 2 +- .../wrapPageComponentWithSentry.ts | 4 ++-- packages/nextjs/src/common/utils/wrapperUtils.ts | 4 ++-- packages/nextjs/src/common/withServerActionInstrumentation.ts | 4 +++- .../nextjs/src/common/wrapGenerationFunctionWithSentry.ts | 2 +- packages/nextjs/src/common/wrapMiddlewareWithSentry.ts | 2 +- packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts | 2 +- packages/nextjs/src/common/wrapServerComponentWithSentry.ts | 4 ++-- packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts | 2 +- 11 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/nextjs/src/common/captureRequestError.ts b/packages/nextjs/src/common/captureRequestError.ts index cf24403c10da..09914c80a9fc 100644 --- a/packages/nextjs/src/common/captureRequestError.ts +++ b/packages/nextjs/src/common/captureRequestError.ts @@ -38,7 +38,7 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC captureException(error, { mechanism: { handled: false, - type: 'nextjs.onRequestError', + type: 'auto.function.nextjs.onRequestError', }, }); diff --git a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts index b6b4bd109527..fe02a1da168c 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts @@ -45,7 +45,7 @@ export async function captureUnderscoreErrorException(contextOrProps: ContextOrP // is what passing a string to `captureException` will wind up doing) captureException(err || `_error.js called with falsy error (${err})`, { mechanism: { - type: 'nextjs._error', + type: 'auto.function.nextjs.underscoreError', handled: false, data: { function: '_error.getInitialProps', diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts index 058e53174441..f251efe1cdd6 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts @@ -112,7 +112,7 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz captureException(objectifiedErr, { mechanism: { - type: 'nextjs.api', + type: 'auto.http.nextjs.apiHandler', handled: false, data: { wrapped_handler: wrappingTarget.name, diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts index ea11710ca74a..a2999224f9a7 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts @@ -48,7 +48,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C captureException(e, { mechanism: { handled: false, - type: 'nextjs.page.class', + type: 'auto.function.nextjs.pageClass', }, }); throw e; @@ -78,7 +78,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C captureException(e, { mechanism: { handled: false, - type: 'nextjs.page.function', + type: 'auto.function.nextjs.pageFunction', }, }); throw e; diff --git a/packages/nextjs/src/common/utils/wrapperUtils.ts b/packages/nextjs/src/common/utils/wrapperUtils.ts index 3661e7ce3445..e5d6efba3d45 100644 --- a/packages/nextjs/src/common/utils/wrapperUtils.ts +++ b/packages/nextjs/src/common/utils/wrapperUtils.ts @@ -28,7 +28,7 @@ export function withErrorInstrumentation any>( captureException(e, { // TODO: check if origFunction.name actually returns the correct name or minified garbage // in this case, we can add another argument to this wrapper with the respective function name - mechanism: { handled: false, type: 'nextjs.wrapped', data: { function: origFunction.name } }, + mechanism: { handled: false, type: 'auto.function.nextjs.wrapped', data: { function: origFunction.name } }, }); throw e; } @@ -103,7 +103,7 @@ export async function callDataFetcherTraced Promis try { return await origFunction(...origFunctionArgs); } catch (e) { - captureException(e, { mechanism: { handled: false, type: 'nextjs' } }); + captureException(e, { mechanism: { handled: false, type: 'auto.function.nextjs.dataFetcher' } }); throw e; } } diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index 39af5a46bfcb..403cfabd42bb 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -7,6 +7,7 @@ import { getClient, getIsolationScope, handleCallbackErrors, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, startSpan, @@ -116,6 +117,7 @@ async function withServerActionInstrumentationImplementation { @@ -130,7 +132,7 @@ async function withServerActionInstrumentationImplementation a captureException(err, { mechanism: { handled: false, - type: 'nextjs.generation-function', + type: 'auto.function.nextjs.generationFunction', data: { function: generationFunctionIdentifier, }, diff --git a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts index 5fc0384d2880..225639d4834b 100644 --- a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts +++ b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts @@ -108,7 +108,7 @@ export function wrapMiddlewareWithSentry( error => { captureException(error, { mechanism: { - type: 'nextjs.middleware', + type: 'auto.function.nextjs.wrapMiddlewareWithSentry', handled: false, }, }); diff --git a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts index fc2448d05722..50de70635b06 100644 --- a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts @@ -96,7 +96,7 @@ export function wrapRouteHandlerWithSentry any>( captureException(error, { mechanism: { handled: false, - type: 'nextjs.route-handler', + type: 'auto.function.nextjs.routeHandler', }, }); } diff --git a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts index e951b44769ef..77b6d5204c7f 100644 --- a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts +++ b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts @@ -114,7 +114,7 @@ export function wrapServerComponentWithSentry any> name: `${componentType} Server Component (${componentRoute})`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.serverComponent', 'sentry.nextjs.ssr.function.type': componentType, 'sentry.nextjs.ssr.function.route': componentRoute, }, @@ -136,7 +136,7 @@ export function wrapServerComponentWithSentry any> captureException(error, { mechanism: { handled: false, - type: 'nextjs.server-component', + type: 'auto.function.nextjs.serverComponent', }, }); } diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index eb8baa3b172c..6facf5e2ffa8 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -89,7 +89,7 @@ export function wrapApiHandlerWithSentry( error => { captureException(error, { mechanism: { - type: 'nextjs.edge.api', + type: 'auto.function.nextjs.wrapApiHandlerWithSentry', handled: false, }, }); From 4ad3a06029180e007655a689464bdbfa3366de31 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 8 Sep 2025 10:24:32 +0200 Subject: [PATCH 3/8] fix and add tests --- .../nextjs-13/tests/client/click-error.test.ts | 12 +++++++++++- .../nextjs-13/tests/client/sessions.test.ts | 1 + .../tests/server/getServerSideProps.test.ts | 4 ++-- .../tests/server/pages-router-api-endpoints.test.ts | 2 +- .../tests/server/server-component-error.test.ts | 2 +- .../nextjs-15/tests/nested-rsc-error.test.ts | 5 +++++ .../nextjs-15/tests/streaming-rsc-error.test.ts | 5 +++++ .../nextjs-app-dir/tests/client-errors.test.ts | 9 +++++++++ .../nextjs-app-dir/tests/edge.test.ts | 5 +++++ .../nextjs-orpc/tests/orpc-error.test.ts | 6 ++++++ .../nextjs-pages-dir/tests/pages-ssr-errors.test.ts | 5 +++++ .../nextjs-t3/tests/trpc-error.test.ts | 5 +++++ 12 files changed, 56 insertions(+), 5 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts index a9fbcdb69a45..b587791f2e90 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts @@ -13,8 +13,18 @@ test('should send error for faulty click handlers', async ({ page }) => { expect(errorEvent).toBeDefined(); - const frames = errorEvent?.exception?.values?.[0]?.stacktrace?.frames; + const exception = errorEvent?.exception?.values?.[0]; + + expect(exception?.mechanism).toEqual({ + type: 'auto.browser.browserapierrors.addEventListener', + handled: false, + data: { + handler: 'bound ed', + target: 'EventTarget', + }, + }); + const frames = exception?.stacktrace?.frames; await test.step('error should have a non-url-encoded top frame in route with parameter', () => { if (process.env.TEST_ENV === 'development') { // In dev mode we want to check local source mapping diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts index 8fbe8ac8b7b5..5ed4500928e7 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts @@ -5,6 +5,7 @@ test('should report healthy sessions', async ({ page }) => { test.skip(process.env.TEST_ENV === 'development', 'test is flakey in dev mode'); const sessionPromise = waitForSession('nextjs-13', session => { + console.log('session', session); return session.init === true && session.status === 'ok' && session.errors === 0; }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/getServerSideProps.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/getServerSideProps.test.ts index 60f9842ca20e..3338d8e28595 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/getServerSideProps.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/getServerSideProps.test.ts @@ -23,7 +23,7 @@ test('Should report an error event for errors thrown in getServerSideProps', asy exception: { values: [ { - mechanism: { handled: false, type: 'generic' }, + mechanism: { handled: false, type: 'auto.function.nextjs.wrapped' }, type: 'Error', value: 'getServerSideProps Error', stacktrace: { @@ -110,7 +110,7 @@ test('Should report an error event for errors thrown in getServerSideProps in pa exception: { values: [ { - mechanism: { handled: false, type: 'generic' }, + mechanism: { handled: false, type: 'auto.function.nextjs.wrapped' }, type: 'Error', value: 'custom page extension error', stacktrace: { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts index 36592b56fb94..0747df483750 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts @@ -30,7 +30,7 @@ test('Should report an error event for errors thrown in pages router api routes' function: 'withSentry', }, handled: false, - type: 'instrument', + type: 'auto.http.nextjs.apiHandler', }, stacktrace: { frames: expect.arrayContaining([]) }, type: 'Error', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts index 937d7c8da6c0..810c63b441a7 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts @@ -20,7 +20,7 @@ test('Should capture an error thrown in a server component', async ({ page }) => exception: { values: [ { - mechanism: { handled: false, type: 'generic' }, + mechanism: { handled: false, type: 'auto.function.nextjs.serverComponent' }, type: 'Error', value: 'RSC error', }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts index 863e5de111a2..68563af320e5 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts @@ -41,4 +41,9 @@ test('Should capture errors from nested server components when `Sentry.captureRe router_path: '/nested-rsc-error/[param]', request_path: '/nested-rsc-error/123', }); + + expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.function.nextjs.onRequestError', + }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts index 0a20e97be74a..3b1a62aea9c9 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts @@ -41,4 +41,9 @@ test('Should capture errors for crashing streaming promises in server components router_path: '/streaming-rsc-error/[param]', request_path: '/streaming-rsc-error/123', }); + + expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.function.nextjs.onRequestError', + }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts index 091c8fc1e46c..22f5e2bf2ae2 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts @@ -35,4 +35,13 @@ test('Sends a client-side exception to Sentry', async ({ page }) => { trace_id: expect.stringMatching(/[a-f0-9]{32}/), span_id: expect.stringMatching(/[a-f0-9]{16}/), }); + + expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.browser.browserapierrors.addEventListener', + data: { + handler: expect.stringContaining('bound uM'), + target: 'EventTarget', + }, + }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts index 934cfa2e472d..662d5ddeb1e0 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts @@ -19,6 +19,11 @@ test('Should record exceptions for faulty edge server components', async ({ page expect(errorEvent.tags?.['my-global-scope-isolated-tag']).not.toBeDefined(); expect(errorEvent.transaction).toBe(`Page Server Component (/edge-server-components/error)`); + + expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.function.nextjs.serverComponent', + }); }); test('Should record transaction for edge server components', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-error.test.ts index 8a9f371972c0..a503533b6f00 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-error.test.ts @@ -19,4 +19,10 @@ test('should capture orpc error', async ({ page }) => { }), ], }); + + // orpc errors are captured manually by the orpc middleware (user-land) + expect(orpcError.exception?.values?.[0]?.mechanism).toEqual({ + handled: true, + type: 'generic', + }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts index c3925f52ba48..f2fc25d8b8d5 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts @@ -43,4 +43,9 @@ test('Will capture error for SSR rendering error with a connected trace (Functio // TODO(lforst): Reuse SSR request span isolation scope to fix the following two assertions // expect(ssrTransaction.tags?.['my-isolated-tag']).toBe(true); // expect(ssrTransaction.tags?.['my-global-scope-isolated-tag']).not.toBeDefined(); + + expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.function.nextjs.pageFunction', + }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts index d3e175e0558b..d510d6008784 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts @@ -16,6 +16,11 @@ test('should capture error with trpc context', async ({ page }) => { expect(trpcError.contexts?.trpc?.procedure_type).toEqual('mutation'); expect(trpcError.contexts?.trpc?.procedure_path).toBe('post.throwError'); expect(trpcError.contexts?.trpc?.input).toEqual({ name: 'I love dogs' }); + + expect(trpcError.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.function.nextjs.trpc', + }); }); test('should create transaction with trpc input for error', async ({ page }) => { From 2bb9a6ed99e1a3e8b2996fc7c7aa72ea9d16bb5e Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 8 Sep 2025 10:35:48 +0200 Subject: [PATCH 4/8] fix some more tests --- .../test-applications/nextjs-t3/tests/trpc-error.test.ts | 5 ++++- .../nextjs-turbo/tests/app-router/rsc-error.test.ts | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts index d510d6008784..2a7af1b14d52 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-t3/tests/trpc-error.test.ts @@ -19,7 +19,10 @@ test('should capture error with trpc context', async ({ page }) => { expect(trpcError.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.function.nextjs.trpc', + type: 'auto.rpc.trpc.middleware', + exception_id: 1, + parent_id: 0, + source: 'cause', }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts index 604faae7ea59..6dbeb172ba4d 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts @@ -11,4 +11,8 @@ test('Should capture errors from server components', async ({ page }) => { const errorEvent = await errorEventPromise; expect(errorEvent).toBeDefined(); + expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ + handled: false, + type: 'auto.function.nextjs.onRequestError', + }); }); From b0d5aaee8cf97f54a5d9d1a2c64557e534682291 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 10 Sep 2025 18:19:05 +0200 Subject: [PATCH 5/8] relax tests a bit --- .../nextjs-13/tests/client/click-error.test.ts | 2 +- .../nextjs-app-dir/tests/client-errors.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts index b587791f2e90..481e7264c62d 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts @@ -19,7 +19,7 @@ test('should send error for faulty click handlers', async ({ page }) => { type: 'auto.browser.browserapierrors.addEventListener', handled: false, data: { - handler: 'bound ed', + handler: expect.any(String), // the handler name varies in CI and locally target: 'EventTarget', }, }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts index 22f5e2bf2ae2..ee92898905e6 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts @@ -40,7 +40,7 @@ test('Sends a client-side exception to Sentry', async ({ page }) => { handled: false, type: 'auto.browser.browserapierrors.addEventListener', data: { - handler: expect.stringContaining('bound uM'), + handler: expect.any(String), // the handler name varies in CI and locally target: 'EventTarget', }, }); From af23e853b375566a39c68cc968341b565c0df7a1 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Thu, 11 Sep 2025 15:02:00 +0200 Subject: [PATCH 6/8] fix tests for app dir test on 15 --- .../nextjs-app-dir/tests/client-errors.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts index ee92898905e6..580368f4b9a1 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts @@ -38,10 +38,12 @@ test('Sends a client-side exception to Sentry', async ({ page }) => { expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.browser.browserapierrors.addEventListener', - data: { - handler: expect.any(String), // the handler name varies in CI and locally - target: 'EventTarget', - }, + type: nextjsMajor >= 15 ? 'auto.browser.global_handlers.onerror' : 'auto.browser.browserapierrors.addEventListener', + ...(nextjsMajor < 15 && { + data: { + handler: expect.any(String), // the handler name varies in CI and locally + target: 'EventTarget', + }, + }), }); }); From d6bead80963584f8d5403059310acf2c797d4590 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 12 Sep 2025 16:17:10 +0200 Subject: [PATCH 7/8] Update dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts --- .../test-applications/nextjs-13/tests/client/sessions.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts index 5ed4500928e7..8fbe8ac8b7b5 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts @@ -5,7 +5,6 @@ test('should report healthy sessions', async ({ page }) => { test.skip(process.env.TEST_ENV === 'development', 'test is flakey in dev mode'); const sessionPromise = waitForSession('nextjs-13', session => { - console.log('session', session); return session.init === true && session.status === 'ok' && session.errors === 0; }); From f5ae12fc68dd0f14d9dbf84c5234d3a51d69a08d Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 12 Sep 2025 16:23:09 +0200 Subject: [PATCH 8/8] snake_case --- .../nextjs-13/tests/server/pages-router-api-endpoints.test.ts | 2 +- .../nextjs-13/tests/server/server-component-error.test.ts | 2 +- .../nextjs-15/tests/nested-rsc-error.test.ts | 2 +- .../nextjs-15/tests/streaming-rsc-error.test.ts | 2 +- .../test-applications/nextjs-app-dir/tests/edge.test.ts | 2 +- .../nextjs-pages-dir/tests/pages-ssr-errors.test.ts | 2 +- .../nextjs-turbo/tests/app-router/rsc-error.test.ts | 2 +- packages/nextjs/src/common/captureRequestError.ts | 2 +- .../nextjs/src/common/pages-router-instrumentation/_error.ts | 2 +- .../pages-router-instrumentation/wrapApiHandlerWithSentry.ts | 2 +- .../wrapPageComponentWithSentry.ts | 4 ++-- packages/nextjs/src/common/utils/wrapperUtils.ts | 2 +- packages/nextjs/src/common/withServerActionInstrumentation.ts | 4 ++-- .../nextjs/src/common/wrapGenerationFunctionWithSentry.ts | 2 +- packages/nextjs/src/common/wrapMiddlewareWithSentry.ts | 4 ++-- packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts | 2 +- packages/nextjs/src/common/wrapServerComponentWithSentry.ts | 4 ++-- packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts | 4 ++-- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts index 0747df483750..9f5ff5db8434 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts @@ -30,7 +30,7 @@ test('Should report an error event for errors thrown in pages router api routes' function: 'withSentry', }, handled: false, - type: 'auto.http.nextjs.apiHandler', + type: 'auto.http.nextjs.api_handler', }, stacktrace: { frames: expect.arrayContaining([]) }, type: 'Error', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts index 810c63b441a7..c485c02716a3 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts @@ -20,7 +20,7 @@ test('Should capture an error thrown in a server component', async ({ page }) => exception: { values: [ { - mechanism: { handled: false, type: 'auto.function.nextjs.serverComponent' }, + mechanism: { handled: false, type: 'auto.function.nextjs.server_component' }, type: 'Error', value: 'RSC error', }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts index 68563af320e5..68d03a00d601 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts @@ -44,6 +44,6 @@ test('Should capture errors from nested server components when `Sentry.captureRe expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.function.nextjs.onRequestError', + type: 'auto.function.nextjs.on_request_error', }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts index 3b1a62aea9c9..6133d0fa29b1 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts @@ -44,6 +44,6 @@ test('Should capture errors for crashing streaming promises in server components expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.function.nextjs.onRequestError', + type: 'auto.function.nextjs.on_request_error', }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts index 662d5ddeb1e0..a19fe3402951 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts @@ -22,7 +22,7 @@ test('Should record exceptions for faulty edge server components', async ({ page expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.function.nextjs.serverComponent', + type: 'auto.function.nextjs.server_component', }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts index f2fc25d8b8d5..e5539244570f 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/pages-ssr-errors.test.ts @@ -46,6 +46,6 @@ test('Will capture error for SSR rendering error with a connected trace (Functio expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.function.nextjs.pageFunction', + type: 'auto.function.nextjs.page_function', }); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts index 6dbeb172ba4d..d9c94de2d2be 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-turbo/tests/app-router/rsc-error.test.ts @@ -13,6 +13,6 @@ test('Should capture errors from server components', async ({ page }) => { expect(errorEvent).toBeDefined(); expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({ handled: false, - type: 'auto.function.nextjs.onRequestError', + type: 'auto.function.nextjs.on_request_error', }); }); diff --git a/packages/nextjs/src/common/captureRequestError.ts b/packages/nextjs/src/common/captureRequestError.ts index 09914c80a9fc..6fd2e83d3188 100644 --- a/packages/nextjs/src/common/captureRequestError.ts +++ b/packages/nextjs/src/common/captureRequestError.ts @@ -38,7 +38,7 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC captureException(error, { mechanism: { handled: false, - type: 'auto.function.nextjs.onRequestError', + type: 'auto.function.nextjs.on_request_error', }, }); diff --git a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts index fe02a1da168c..354fbe0438e2 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts @@ -45,7 +45,7 @@ export async function captureUnderscoreErrorException(contextOrProps: ContextOrP // is what passing a string to `captureException` will wind up doing) captureException(err || `_error.js called with falsy error (${err})`, { mechanism: { - type: 'auto.function.nextjs.underscoreError', + type: 'auto.function.nextjs.underscore_error', handled: false, data: { function: '_error.getInitialProps', diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts index f251efe1cdd6..4cf8fde751fb 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts @@ -112,7 +112,7 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz captureException(objectifiedErr, { mechanism: { - type: 'auto.http.nextjs.apiHandler', + type: 'auto.http.nextjs.api_handler', handled: false, data: { wrapped_handler: wrappingTarget.name, diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts index a2999224f9a7..693341024726 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts @@ -48,7 +48,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C captureException(e, { mechanism: { handled: false, - type: 'auto.function.nextjs.pageClass', + type: 'auto.function.nextjs.page_class', }, }); throw e; @@ -78,7 +78,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C captureException(e, { mechanism: { handled: false, - type: 'auto.function.nextjs.pageFunction', + type: 'auto.function.nextjs.page_function', }, }); throw e; diff --git a/packages/nextjs/src/common/utils/wrapperUtils.ts b/packages/nextjs/src/common/utils/wrapperUtils.ts index e5d6efba3d45..5bde1f76f0d4 100644 --- a/packages/nextjs/src/common/utils/wrapperUtils.ts +++ b/packages/nextjs/src/common/utils/wrapperUtils.ts @@ -103,7 +103,7 @@ export async function callDataFetcherTraced Promis try { return await origFunction(...origFunctionArgs); } catch (e) { - captureException(e, { mechanism: { handled: false, type: 'auto.function.nextjs.dataFetcher' } }); + captureException(e, { mechanism: { handled: false, type: 'auto.function.nextjs.data_fetcher' } }); throw e; } } diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index 403cfabd42bb..f5a1170cc44b 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -117,7 +117,7 @@ async function withServerActionInstrumentationImplementation { @@ -132,7 +132,7 @@ async function withServerActionInstrumentationImplementation a captureException(err, { mechanism: { handled: false, - type: 'auto.function.nextjs.generationFunction', + type: 'auto.function.nextjs.generation_function', data: { function: generationFunctionIdentifier, }, diff --git a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts index 225639d4834b..ab05fbd5e944 100644 --- a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts +++ b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts @@ -98,7 +98,7 @@ export function wrapMiddlewareWithSentry( op: 'http.server.middleware', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: spanSource, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.wrapMiddlewareWithSentry', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.wrap_middleware', ...headerAttributes, }, }, @@ -108,7 +108,7 @@ export function wrapMiddlewareWithSentry( error => { captureException(error, { mechanism: { - type: 'auto.function.nextjs.wrapMiddlewareWithSentry', + type: 'auto.function.nextjs.wrap_middleware', handled: false, }, }); diff --git a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts index 50de70635b06..54858a9bdae2 100644 --- a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts @@ -96,7 +96,7 @@ export function wrapRouteHandlerWithSentry any>( captureException(error, { mechanism: { handled: false, - type: 'auto.function.nextjs.routeHandler', + type: 'auto.function.nextjs.route_handler', }, }); } diff --git a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts index 77b6d5204c7f..d25225a149f9 100644 --- a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts +++ b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts @@ -114,7 +114,7 @@ export function wrapServerComponentWithSentry any> name: `${componentType} Server Component (${componentRoute})`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.serverComponent', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.server_component', 'sentry.nextjs.ssr.function.type': componentType, 'sentry.nextjs.ssr.function.route': componentRoute, }, @@ -136,7 +136,7 @@ export function wrapServerComponentWithSentry any> captureException(error, { mechanism: { handled: false, - type: 'auto.function.nextjs.serverComponent', + type: 'auto.function.nextjs.server_component', }, }); } diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index 6facf5e2ffa8..735caf8d7788 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -79,7 +79,7 @@ export function wrapApiHandlerWithSentry( op: op, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.wrapApiHandlerWithSentry', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.wrap_api_handler', ...headerAttributes, }, }, @@ -89,7 +89,7 @@ export function wrapApiHandlerWithSentry( error => { captureException(error, { mechanism: { - type: 'auto.function.nextjs.wrapApiHandlerWithSentry', + type: 'auto.function.nextjs.wrap_api_handler', handled: false, }, });