fix(nextjs): Set parameterized transaction name for non-transaction events#19316
fix(nextjs): Set parameterized transaction name for non-transaction events#19316
Conversation
Codecov Results 📊Generated by Codecov Action |
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 14 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 60.31% 83.13% +22.82%
==========================================
Files 756 2 -754
Lines 41847 83 -41764
Branches 7996 57 -7939
==========================================
+ Hits 25248 69 -25179
- Misses 16599 14 -16585
- Partials 82 8 -74Generated by Codecov Action |
dev-packages/e2e-tests/test-applications/nextjs-16/tests/route-handler.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| handled: false, | ||
| type: 'auto.function.nextjs.on_request_error', | ||
| }); | ||
| } |
There was a problem hiding this comment.
Test uses conditional instead of separate test cases
Low Severity
The test at line 69 uses if (process.env.TEST_ENV === 'development') to conditionally run assertions for nextjs context and mechanism. Per the project review rules, conditionals within a single test case are discouraged — the recommendation is to split the test into separate test cases for each environment path. This ensures both paths are always visible in test results and avoids silently skipping assertions.
Triggered by project rule: PR Review Guidelines for Cursor Bot


Calls to
Sentry.captureException()inside a Next.js App Router route handler, lead to unparameterized transaction namestransactionfrom the isolation scope'stransactionName, which is set to the raw URL byhttpServerIntegration. On turbopack, the webpack wrapping loader doesn't run, sowrapRouteHandlerWithSentry(which sets the parameterized name on the current scope) is never called.handleOnSpanStartto also set the parameterized route on the isolation scope when hoisting thenext.routeattribute to the root span. This ensures manually captured events get the parameterized route regardless of bundler.throw),captureException, andcaptureMessagewith parameterized routes in thenextjs-16test app.closes #19312