AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

RuntimeServerDeploymentId: Prerendered Flight Payloads Pin Build-Time Deployment Id Causing Infinite MPA Reload Loop

When runtimeServerDeploymentId is enabled and a build artifact is served under a different deployment ID, the navigation build ID embedded in prerendered flight payloads remains the build-time ID. This causes client-side skew detection (responseBuildId !== getNavigationBuildId()) to trigger an MPA fallback on every client navigation, resulting in an infinite hard-reload loop.

highConfidence 95%Next.jsAffected V16.3.3Affected V16.4.0-Canary.12

Origin Analysis

The prerendered flight payload's `b` field (navigation build ID) is serialized at build time with the build-time deployment ID. At runtime, `data-dpl-id` and dynamic response headers correctly use the runtime deployment ID, but the prerendered payload is not updated, so the client receives a mismatched navigation build ID and falls back to full document navigations.
1. Build a Next.js app with `NEXT_DEPLOYMENT_ID=dpl_aaaaaaaaaaaaaaaa` and `experimental.runtimeServerDeploymentId` enabled. 2. Start the server with `NEXT_DEPLOYMENT_ID=dpl_bbbbbbbbbbbbbbbb` using the same build artifact. 3. Open a fully prerendered page and click a `<Link>` to a dynamic page. 4. Observe in the Network tab that a full document navigation occurs instead of a client-side RSC navigation. Repeat the click; the hard reload never recovers. 5. Control: restart with the same deployment ID as build (`dpl_aaaaaaaaaaaaaaaa`) and the same click performs a client-side navigation.

Fixing Code Block

Edge Case Audit

The regex-based replacement may inadvertently modify other `"b":"..."` strings in the HTML if they appear outside the Flight payload (e.g., in user-generated content). It should be scoped to the Flight data script tags or use a placeholder during build. Additionally, ensure `getDeploymentId()` is available in all server entry points. Rollback: set `NEXT_DEPLOYMENT_ID` to the build-time ID or disable `runtimeServerDeploymentId`.

Ecosystem Topology