hcengineering/platform · critical · Error
Missing config for attributes: ${missingEnv.join(', ')}
Error message
Missing config for attributes: ${missingEnv.join(', ')} What it means
The export service config module (services/export/pod-export/src/config.ts) assembles params (including DbURL from process.env.DB_URL) at import time and throws this error when any params value is undefined. The message enumerates the missing Config attribute names. It guarantees the export service never boots with incomplete configuration.
Source
Thrown at services/export/pod-export/src/config.ts:38
ServiceID: string
DbURL: string
}
const parseNumber = (str: string | undefined): number | undefined => (str !== undefined ? Number(str) : undefined)
const config: Config = (() => {
const params: Partial<Config> = {
Port: parseNumber(process.env.PORT) ?? 4009,
Secret: process.env.SECRET,
AccountsUrl: process.env.ACCOUNTS_URL,
ServiceID: process.env.SERVICE_ID,
DbURL: process.env.DB_URL
}
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
- Set DB_URL (and any other attributes named in the error) in the service environment before startup.
- Check the deployment platform's secret/ConfigMap wiring maps DB_URL to the container env.
- Add a local .env with DB_URL for development, loaded before the config module is imported.
- Confirm the connection string is actually defined (empty string is defined, so this specific error means truly unset).
Example fix
// before DB_URL unset -> throw at import // after # .env DB_URL=postgres://user:pass@host:5432/exportdb
Defensive patterns
Strategy: validation
Validate before calling
const required = ['DB_URL'];
const missing = required.filter((k) => !process.env[k]);
if (missing.length) throw new Error(`Missing env vars: ${missing.join(', ')}`);
// also sanity-check it parses as a URL
new URL(process.env.DB_URL!); Type guard
function isSet(v: string | undefined): v is string {
return v !== undefined && v.length > 0;
} Try / catch
try {
const { default: config } = await import('./src/config.js');
} catch (e) {
console.error(`Export service misconfigured: ${(e as Error).message}`);
process.exit(1);
} Prevention
- Store DB_URL as a managed secret and reference it in the deployment manifest.
- Test DB connectivity right after config load to catch wrong values early.
- Maintain .env.example parity with config.ts keys.
When it happens
Trigger: process.env.DB_URL (or any other required key of params in this config) is undefined when the module is first imported. Importing any file that depends on this config triggers the throw.
Common situations: Database URL not provided in the pod's environment; secrets not mounted in the deployment; running tests locally without a .env; migrating between environments and forgetting DB_URL.
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
- Missing config for attributes: ${missingEnv.join(', ')}
- Missing env variables: ${missingEnv.join(', ')}
- Missing env variables: ${missingEnv.join(', ')}
- Missing env variables: ${missingEnv.join(', ')}
- WORKSPACE_URL env var is not set
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/cef0fc5c0c64d56f.
Report an issue: GitHub.