vercel/next.js · error · Error

process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerD

Error message

process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled

What it means

Thrown in getNextConfigEdge while resolving config for an edge route module: experimental.runtimeServerDeploymentId is enabled in the loaded next config, but the NEXT_DEPLOYMENT_ID environment variable was not present/inlined when the edge bundle was built. Edge bundles read config from the server files manifest, so the deployment id the feature requires is simply missing from the environment.

Source

Thrown at packages/next/src/server/route-modules/route-module.ts:599

        'Invariant: getNextConfigEdge must only be called in edge runtime'
      )
    }

    let serverFilesManifest = self.__SERVER_FILES_MANIFEST as any as
      | RequiredServerFilesManifest
      | undefined
    const routerServerContext = this.getRouterServerContext(req)
    const nextConfig =
      routerServerContext?.nextConfig || serverFilesManifest?.config

    if (!nextConfig) {
      throw new Error("Invariant: nextConfig couldn't be loaded")
    }

    let deploymentId
    if (nextConfig.experimental?.runtimeServerDeploymentId) {
      if (!process.env.NEXT_DEPLOYMENT_ID) {
        throw new Error(
          'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'
        )
      }
      deploymentId = process.env.NEXT_DEPLOYMENT_ID
    } else {
      deploymentId = nextConfig.deploymentId || ''
    }

    return { nextConfig, deploymentId }
  }

  public prepare(
    req: IncomingMessage | BaseNextRequest,
    res: ServerResponse | null,
    options: {
      srcPage: string
      multiZoneDraftMode?: boolean
    }

View on GitHub (pinned to 43273a1d21)

Solutions

  1. Set NEXT_DEPLOYMENT_ID in the environment, or disable runtimeServerDeploymentId.
Defensive patterns

Strategy: validation

When it happens

Trigger: runtimeServerDeploymentId is enabled but NEXT_DEPLOYMENT_ID is unset.

Common situations: Route module initialization requires the deployment id env var that was not provided.


AI-assisted analysis of vercel/next.js@43273a1d21 (2026-08-19). Data as JSON: /api/errors/857c099b3715b5e7. Report an issue: GitHub.