{"record":{"id":"c577636eeab8d952","repo":"vercel/next.js","slug":"process-env-next-deployment-id-is-missing-but-runt","errorCode":null,"errorMessage":"process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled","messagePattern":"process\\.env\\.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/next/src/server/base-server.ts","lineNumber":492,"sourceCode":"\n    this.dir = path.resolve(/* turbopackIgnore: true */ dir)\n\n    this.quiet = quiet\n    this.loadEnvConfig({ dev, forceReload: false })\n\n    // TODO: should conf be normalized to prevent missing\n    // values from causing issues as this can be user provided\n    this.nextConfig = conf as NextConfigRuntime\n    if (\n      (dev || process.env.__NEXT_DEV_SERVER) &&\n      this.nextConfig.experimental.requestInsights\n    ) {\n      process.env.__NEXT_REQUEST_INSIGHTS = 'true'\n    }\n\n    if (this.nextConfig.experimental.runtimeServerDeploymentId) {\n      if (!process.env.NEXT_DEPLOYMENT_ID) {\n        throw new Error(\n          'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n        )\n      }\n      this.deploymentId = process.env.NEXT_DEPLOYMENT_ID\n    } else {\n      let id = this.nextConfig.experimental.useSkewCookie\n        ? ''\n        : this.nextConfig.deploymentId || ''\n\n      this.deploymentId = id\n      process.env.NEXT_DEPLOYMENT_ID = id\n    }\n    ;(globalThis as any).NEXT_CLIENT_ASSET_SUFFIX =\n      this.nextConfig.supportsImmutableAssets || !this.deploymentId\n        ? ''\n        : `?dpl=${this.deploymentId}`\n\n    this.hostname = hostname","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/base-server.ts#L474-L510","documentation":"Thrown during NextServer/NextNodeServer construction when the experimental runtimeServerDeploymentId flag is enabled but process.env.NEXT_DEPLOYMENT_ID is not set. The feature requires a deployment id at runtime to stamp assets/routes; its absence is a misconfiguration, so startup aborts.","triggerScenarios":"next.config.js sets experimental.runtimeServerDeploymentId = true, but the NEXT_DEPLOYMENT_ID environment variable is unset when the server boots. The constructor (base-server.ts:490-495) checks and throws immediately.","commonSituations":"Enabling the experimental deployment-id feature without providing the env var; CI/local dev copying a config that expects a platform-provided NEXT_DEPLOYMENT_ID; feature flag left on from a template.","solutions":["Set NEXT_DEPLOYMENT_ID to a stable value in your environment (e.g. a commit sha or release id) before starting the server.","If you do not need the feature, remove experimental.runtimeServerDeploymentId (or set it false) from next.config.js.","Ensure your deploy pipeline injects NEXT_DEPLOYMENT_ID consistently across all instances.","Validate the env var is present in your runtime environment before the server starts."],"exampleFix":"// before\n// next.config.js: { experimental: { runtimeServerDeploymentId: true } }\n// (NEXT_DEPLOYMENT_ID unset)\n\n// after: provide the env var\n// NEXT_DEPLOYMENT_ID=abc123 next start","handlingStrategy":"validation","validationCode":"// Fail fast at startup if the required env is missing.\nif (require('./next.config.js').experimental?.runtimeServerDeploymentId) {\n  if (!process.env.NEXT_DEPLOYMENT_ID) {\n    throw new Error('runtimeServerDeploymentId requires NEXT_DEPLOYMENT_ID')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set NEXT_DEPLOYMENT_ID when enabling runtimeServerDeploymentId.","Inject NEXT_DEPLOYMENT_ID from your CI release id/commit sha.","Remove the experimental flag if you don't need it.","Add an env-var check to your deploy script."],"tags":["deployment-id","configuration","startup","experimental"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}