Skip to content

Conversation

mjq
Copy link
Member

@mjq mjq commented Aug 29, 2025

The Next.js SDK has code to parameterize transaction names for frontend URLs. This code wasn't working correctly for catchall routes at the root (e.g. app/[[...path]]).

The regex generated by buildRegexForDynamicRoute in this case was previously ^/(?:/(.*))?$ - note that because it starts with a / and then requires another / in the optional group, it would only match the full path / or paths starting with //. In practice, that meant paths other than / never matched. As a result, the paths were used verbatim as the transaction name, with sentry.source set to url. Such paths would then go on to trigger our transaction name clusterer due to their high cardinality.

This PR fixes the regex generation for root catchall routes so that the routes are parameterized on the frontend as expected. Resulting routes have sentry.source set to route, meaning that the transaction clusterer is not triggered.

@mjq mjq requested review from chargome, AbhiPrasad and Lms24 August 29, 2025 18:36
cursor[bot]

This comment was marked as outdated.

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks for adding this!

@chargome chargome merged commit 7931f8d into develop Sep 1, 2025
57 checks passed
@chargome chargome deleted the mjq/fix-nextjs-root-catchall branch September 1, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants