Crux
Errors

NAMESPACE_AMBIGUOUS

serverless() could not resolve a safe production Runtime Engine namespace.

What failed

serverless() throws this error while composing a runtime in production when it cannot resolve a safe namespace. A runtime namespace partitions all durable work, events, waiters, timers, outbox records, leases, and idempotency keys.

Why

Production and preview deployments can share a database or queue substrate. Falling back to local there could make those deployments share runtime state accidentally.

Resolution order

Crux uses the first available value:

  1. serverless({ namespace: "..." })
  2. A non-empty CRUX_RUNTIME_NAMESPACE environment variable (surrounding whitespace is removed)
  3. Vercel deployment inference:
    • VERCEL_ENV=production resolves to production.
    • VERCEL_ENV=preview with VERCEL_GIT_COMMIT_REF resolves to preview-<branch>. Branch names are lowercased and sanitized; for example, Feature/Foo becomes preview-feature-foo.
  4. Outside production (NODE_ENV !== "production"), Crux resolves local for development.

If none of the first three steps applies in production, composition throws NAMESPACE_AMBIGUOUS.

What still works

Development can use the local fallback. Any serverless runtime with an explicit namespace, a configured environment namespace, or supported Vercel deployment signals continues to work.

Fix

Set a production namespace:

CRUX_RUNTIME_NAMESPACE=production

Or pass namespace in the runtime config:

serverless({
  namespace: "production",
  // store and wake adapters
});

On this page