hcengineering/platform · error · Error

Missing config for attributes: ${missingEnv.join(', ')}

Error message

Missing config for attributes: ${missingEnv.join(', ')}

What it means

The pod-sign service config is built inside a module IIFE and throws when any Config field is undefined after reading env variables. The message lists the missing attribute names (Config keys), failing fast at first import.

Source

Thrown at services/sign/pod-sign/src/config.ts:33

}

const parseNumber = (str: string | undefined): number | undefined => (str !== undefined ? Number(str) : undefined)

const config: Config = (() => {
  const params: Partial<Config> = {
    AccountsUrl: process.env.ACCOUNTS_URL,
    Cert: process.env.CERTIFICATE_PATH !== undefined ? fs.readFileSync(process.env.CERTIFICATE_PATH) : undefined,
    CertPwd: process.env.CERTIFICATE_PASSWORD ?? '',
    Port: parseNumber(process.env.PORT) ?? 4006,
    Secret: process.env.SECRET,
    ServiceID: process.env.SERVICE_ID,
    BrandingPath: process.env.BRANDING_PATH ?? ''
  }

  const missingEnv = (Object.keys(params) as Array<keyof Config>).filter((key) => params[key] === undefined)

  if (missingEnv.length > 0) {
    throw Error(`Missing config for attributes: ${missingEnv.join(', ')}`)
  }

  return params as Config
})()

export default config

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Set the listed env variables in the service deployment and restart.
  2. Cross-check keys in services/sign/pod-sign/src/config.ts against your environment.
  3. Provide safe defaults via ?? for genuinely optional settings.
  4. Remember config runs at import — a missing var crashes the pod immediately; check pod logs for which attribute is missing.

Example fix

// before
# SIGN_KEY unset -> throws
// after
SIGN_KEY=MIIE...
SERVICE_ENDPOINT=https://sign.example.com
Defensive patterns

Strategy: validation

Validate before calling

const keys = ['SIGN_KEY', 'SERVICE_ENDPOINT'] // all Config keys without ?? fallback in config.ts
const missing = keys.filter((k) => process.env[k] === undefined)
if (missing.length > 0) throw new Error(`pod-sign missing env: ${missing.join(', ')}`)

Try / catch

try {
  await import('./config.js')
} catch (err) {
  if (err.message.startsWith('Missing config for attributes:')) {
    console.error('pod-sign startup config incomplete:', err.message)
    process.exit(1)
  }
  throw err
}

Prevention

When it happens

Trigger: Launching pod-sign without all signing env variables set. Note BrandingPath has a '' default so it never triggers; only keys without a ?? fallback produce undefined.

Common situations: Missing entries in pod manifests or docker env, .env not loaded locally, typo'd env names, or new required config added by an upgrade.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/8d2662602ee6cb15. Report an issue: GitHub.