hcengineering/platform · error · Error

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

Error message

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

What it means

pod-print's config IIFE iterates every key of the assembled params object and throws if any value is undefined. The params include fields like Port, TemplateUrl/workspace settings, and PuppeteerArgs (built from a comma-separated env value), so any unset variable that leaves a param undefined triggers this error at startup.

Source

Thrown at services/print/pod-print/src/config.ts:36

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

const config: Config = (() => {
  const allowedHostnames = process.env.ALLOWED_HOSTNAMES
  const puppeteerArgs = process.env.PUPPETEER_ARGS ?? ''

  const params: Partial<Config> = {
    Port: parseNumber(process.env.PORT) ?? 4005,
    Secret: process.env.SECRET,
    AccountsUrl: process.env.ACCOUNTS_URL,
    FrontUrl: process.env.FRONT_URL,
    AllowedHostnames: allowedHostnames == null ? [] : allowedHostnames.split(','),
    PuppeteerArgs: puppeteerArgs.split(',')
  }

  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. Read the error message — it lists the exact missing Config keys; map them to env var names via envMap in pod-print/src/config.ts and set them.
  2. Ensure Port is set to a numeric value and the template/workspace URL is provided.
  3. Provide the puppeteer-args env var (comma-separated, e.g. --no-sandbox,--disable-dev-shm-usage) if it is among the listed keys.
  4. Compare your environment against the pod-print example env file before deploying.

Example fix

// before
# only port provided
PORT=4010
// after
PORT=4010
WORKSPACE_URL=https://transactor.example.com
PUPPETEER_ARGS=--no-sandbox,--disable-dev-shm-usage
Defensive patterns

Strategy: validation

Validate before calling

// Check the keys pod-print assembles into params before startup
const required = ['PORT', 'WORKSPACE_URL', 'PUPPETEER_ARGS']; // per envMap in pod-print/src/config.ts
const missing = required.filter((k) => process.env[k] === undefined || process.env[k] === '');
if (missing.length) {
  throw new Error(`pod-print 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-print config incomplete: ${err.message}`);
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: Starting pod-print with any config env var unset — most commonly the port, the workspace/template URL, or the puppeteer-args string (note: an empty-string puppeteerArgs becomes an array, not undefined, but a missing source env leaves the param undefined).

Common situations: Running pod-print without the full example .env; forgetting the workspace/transactor URL in a minimal deployment; deploying without the puppeteer-args variable after a config template changed.

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