Skip to content

nextjs incremental static rendering causes cached trace id, leading to merged client-side transactions from different users/requests #18176

@karlkeefer

Description

@karlkeefer

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

10.25.0

Framework Version

Next 15.5.4 (app router, webpack bundler)

Link to Sentry event

https://healthlearn.sentry.io/insights/frontend/summary/trace/7dfaa5ba195f93155d6a3473fbaebf7f/

Reproduction Example/SDK Setup

We have a route with incremental static rendering where this issue occurs.
The app/(static)/go/[slug]/[[...share]]/page.tsx looks like this:

// both of these also need to set for Incremental Static Regeneration...
// https://github.com/vercel/next.js/discussions/57961#discussioncomment-8491488
export const dynamicParams = true;
export const generateStaticParams = async () => [];

export async function generateMetadata(props: {
  params: Promise<{ slug: string; share?: string[] }>;
}) {
  const params = await props.params;

  return {
    title: params.slug,
  };
}


// Note: this is a server-side component, and doesn't require auth
export default async function Page(props: {
  params: Promise<{ slug: string; share?: string[] }>;
}) {
  return (
    <>hello world</>
  );
}

Steps to Reproduce

  1. Do a production build with a page like that.
  2. Load a url that hits that page
  3. refresh multiple times and you'll get the same trace id across requests

Expected Result

I'd expect incremental static page to not have a trace id in the cached output, and to only see client-side transaction data for these routes.

Actual Result

Image

We get a bunch of erroneous trace timings for these incremental static routes because of the pageloads getting merged into one trace.

Additional Context

It appears that this isn't an issue for normal static pages that are built during the build phase.

I think this PR may be closely related to the issue.

I tried various ways to work around this, but I couldn't find a configuration flag to actually prevent injection of the meta tags by default.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions