hcengineering/platform · error · Error
Missing config for attributes: ${missingEnv.join(', ')}
Error message
Missing config for attributes: ${missingEnv.join(', ')} What it means
The backup-api-pod config IIFE checks every Config field for undefined and throws 'Missing config for attributes' at import time. Since Port has a default (4039), the throw can only come from SECRET, BUCKET_NAME, ACCOUNTS_URL, or STORAGE being unset.
Source
Thrown at services/backup/backup-api-pod/src/config.ts:39
Bucket: string
Storage: 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) ?? 4039,
Secret: process.env.SECRET,
Bucket: process.env.BUCKET_NAME,
AccountsUrl: process.env.ACCOUNTS_URL,
Storage: process.env.STORAGE
}
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 the env vars named in the message: SECRET, ACCOUNTS_URL, BUCKET_NAME, STORAGE.
- Provide STORAGE as a valid storage-config JSON (e.g. {"name":"minio","kind":"s3",...}).
- Verify k8s Secret/ConfigMap mounts and exact env key spelling.
- Create a .env with all four vars for local development.
Example fix
// before
BUCKET_NAME=backups # STORAGE missing
// after
SECRET=...
ACCOUNTS_URL=https://accounts.example.com
BUCKET_NAME=backups
STORAGE={"name":"minio","kind":"s3","endpoint":"http://minio:9000"} Defensive patterns
Strategy: validation
Validate before calling
const missing = ['SECRET','ACCOUNTS_URL','BUCKET_NAME','STORAGE'].filter((k) => process.env[k] === undefined)
if (missing.length > 0) throw new Error(`Missing config for attributes: ${missing.join(', ')}`) Type guard
function hasEnv(key: string): boolean {
return process.env[key] !== undefined
} Try / catch
try {
const { default: config } = await import('./config.js')
} catch (err) {
if ((err as Error).message.startsWith('Missing config for attributes:')) {
console.error('backup-api config error:', err.message)
process.exit(1)
}
throw err
} Prevention
- Keep a template STORAGE JSON in .env.example and validate it parses before deploy.
- Confirm BUCKET_NAME exists in your object storage before rollout.
- Inject SECRET via the platform k8s Secret, not inline values.
- Add a startup preflight for all four vars.
When it happens
Trigger: Importing services/backup/backup-api-pod/src/config.ts without one of: SECRET, ACCOUNTS_URL, BUCKET_NAME, STORAGE. STORAGE must be a full bucket-storage config JSON string; BUCKET_NAME the target bucket.
Common situations: Deploying backup-api without the storage config env; missing bucket name in the deployment; secret not injected; local run without .env.
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
- Low level storage is not available
- Missing config for attributes: ${missingEnv.join(', ')}
- Missing config for attributes: ${missingEnv.join(', ')}
- Missing config for attributes: ${missingEnv.join(', ')}
- Missing env variables: ${missingEnv.join(', ')}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/6eef64f0bbc4e8bd.
Report an issue: GitHub.