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

Auto-Enabled Experimental.RuntimeServerDeploymentId Overrides Custom Build-Time Deployment ID And Breaks Skew Protection On Prebuilt Vercel Deployments

When building with vercel build and a custom NEXT_DEPLOYMENT_ID, Next.js 16.2.6 auto-enables experimental.runtimeServerDeploymentId. At runtime, base-server.ts overwrites the deploymentId with Vercel's platform-injected dpl_ ID. Skew Protection pinning for prebuilt deployments relies on the build-time custom ID, so clients receive a mismatched ID and cross-deployment Server Actions fail with UnrecognizedActionError.

highConfidence 95%Next.jsAffected V16.2.6

Origin Analysis

The auto-enable logic in packages/next/src/server/config.ts activates runtimeServerDeploymentId whenever NOW_BUILDER=1, without checking whether a custom build-time deployment ID is already set. This causes base-server.ts to trust the runtime process.env.NEXT_DEPLOYMENT_ID (dpl_...) at request time, overriding the build-time custom ID that Vercel's prebuilt Skew Protection expects.
1. Create a Vercel Pro project with Skew Protection enabled. 2. Build the Next.js app with NEXT_DEPLOYMENT_ID=<custom-id> and vercel build. 3. Deploy with vercel deploy --prebuilt --archive=tgz. 4. Inspect the served HTML and observe data-dpl-id="dpl_..." instead of the custom ID. 5. Trigger a Server Action from a stale tab (or curl with x-deployment-id: <custom-id> vs dpl_...) and observe that dpl_ ID is not pinned and the request fails with UnrecognizedActionError.

Fixing Code Block

Edge Case Audit

Disabling runtimeServerDeploymentId may affect non-prebuilt or future deployment modes that rely on the runtime override. Before applying, verify that your deployment pipeline is strictly prebuilt with a custom build-time NEXT_DEPLOYMENT_ID. If the upstream Next.js fix is released, remove this config override and upgrade to the patched version. Rollback: delete the experimental block or set runtimeServerDeploymentId back to true after confirming the upstream fix.

Ecosystem Topology