Files
Jiwon ChoiandGitHub fa71595a5e Fix early OTel proxy tracers in Cache Components prerenders (#95317)
> [!TIP]
> Best reviewed with hide whitespace.

### Why?

Cache Components prerenders can fail when an OpenTelemetry tracer is
acquired before provider registration and later resolves through proxy
tracer delegation:

```
Next.js encountered the unstable value `Math.random()` while prerendering
```

Current behavior:
https://github.com/vercel/next.js/actions/runs/28518518762/job/84536475151?pr=95317#step:32:343

### How?

Patch proxy tracer delegation to apply the same Cache Components span
instrumentation used for normal tracer lookup.

Closes https://github.com/vercel/next.js/issues/94753

<!-- NEXT_JS_LLM_PR -->
2026-07-01 18:14:06 +02:00

19 lines
371 B
TypeScript

import { TracedComponentEarlyTracerSpan } from '../../traced-work'
export function generateStaticParams() {
return [{ slug: 'prerendered' }]
}
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
if (slug === 'prerendered') {
return null
}
return <TracedComponentEarlyTracerSpan />
}