hcengineering/platform · error · Error

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

Error message

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

What it means

pod-payment's config IIFE requires Port, Secret, AccountsUrl, and FrontUrl to be defined. It lists the raw Config keys (not env names) in the thrown error when any is undefined.

Source

Thrown at services/payment/pod-payment/src/config.ts:63

    Secret: process.env.SECRET,
    AccountsUrl: process.env.ACCOUNTS_URL,
    FrontUrl: process.env.FRONT_URL,
    UseSandbox: process.env.USE_SANDBOX === 'true',
    PolarAccessToken: process.env.POLAR_ACCESS_TOKEN,
    PolarWebhookSecret: process.env.POLAR_WEBHOOK_SECRET,
    PolarOrganizationId: process.env.POLAR_ORGANIZATION_ID,
    PolarSubscriptionPlans: process.env.POLAR_SUBSCRIPTION_PLANS,
    StripeApiKey: process.env.STRIPE_API_KEY,
    StripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
    StripeSubscriptionPlans: process.env.STRIPE_SUBSCRIPTION_PLANS,
    ReconciliationIntervalMinutes: parseNumber(process.env.RECONCILIATION_INTERVAL_MINUTES)
  }

  const requiredKeys: Array<keyof Config> = ['Port', 'Secret', 'AccountsUrl', 'FrontUrl']
  const missingEnv = requiredKeys.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 Port, Secret, AccountsUrl, and FrontUrl in the environment (map each key to its env var name via envMap in pod-payment/src/config.ts).
  2. Use the error message — it names exactly which keys are missing.
  3. Verify AccountsUrl points at the running accounts service and FrontUrl at the payment front-end.
  4. Check that any secret providing 'Secret' is mounted and referenced in the deployment.

Example fix

// before
PORT=4009
ACCOUNTS_URL=http://accounts:3333
// after
PORT=4009
SECRET=shared-service-secret
ACCOUNTS_URL=http://accounts:3333
FRONT_URL=https://payment.example.com
Defensive patterns

Strategy: validation

Validate before calling

const required = ['PORT', 'SECRET', 'ACCOUNTS_URL', 'FRONT_URL'];
const missing = required.filter((k) => process.env[k] === undefined || process.env[k] === '');
if (missing.length) {
  throw new Error(`pod-payment missing env vars: ${missing.join(', ')}`);
}

Try / catch

try {
  await import('./config');
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Missing config for attributes:')) {
    console.error(`pod-payment config incomplete: ${err.message}`);
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: Starting pod-payment with any of the four required env vars unset: Port, Secret, AccountsUrl, or FrontUrl.

Common situations: Forgetting the payment-front URL (FrontUrl) when wiring services; missing the shared Secret used for inter-service auth; new deployments where the accounts service URL changed and AccountsUrl was dropped; partial secret mounts.

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/9efa8ba86fc90e3b. Report an issue: GitHub.