Skip to content

Conversation

@chargome
Copy link
Member

@chargome chargome commented Nov 6, 2025

We need to stop accessing params within our wrapper templates as this can break statically rendered pages and cause cache busts in dynamic pages.

Opened #18115 to investigate other ways of handling the functionality we're removing here.

closes #18097
closes #17431

Note: There's some unused code in the utils that I did not delete as we might be able to reuse this in #18115

@chargome chargome self-assigned this Nov 6, 2025
@chargome chargome merged commit 27af12e into develop Nov 7, 2025
114 of 117 checks passed
@chargome chargome deleted the cg-next-fix-static-template branch November 7, 2025 09:14
logaretm added a commit that referenced this pull request Nov 18, 2025
URLs were missing from server-side transaction events (server
components, generation functions) in Next.js. This was previously
removed in #18113 because we tried to synchronously access `params` and
`searchParams`, which cause builds to crash.

This PR approach adds the URL at runtime using a `preprocessEvent` hook
as suggested.

**Implementation**

1. Reads `http.target` (actual request path) and `next.route`
(parameterized route) from the transaction's trace data
2. Extracts headers from the captured isolation scope's SDK processing
metadata
3. Builds the full URL using the existing `getSanitizedRequestUrl()`
utility
4. Adds it to `normalizedRequest.url` so the `requestDataIntegration`
includes it in the event

This works uniformly for both Webpack and Turbopack across all of our
supported Next.js versions (13~16), I added missing tests for this case
in the versions that did not have it.

Fixes #18115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants