{"record":{"id":"cef0fc5c0c64d56f","repo":"hcengineering/platform","slug":"missing-config-for-attributes-missingenv-join-cef0fc","errorCode":null,"errorMessage":"Missing config for attributes: ${missingEnv.join(', ')}","messagePattern":"Missing config for attributes: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"services/export/pod-export/src/config.ts","lineNumber":38,"sourceCode":"  ServiceID: string\n  DbURL: string\n}\n\nconst parseNumber = (str: string | undefined): number | undefined => (str !== undefined ? Number(str) : undefined)\n\nconst config: Config = (() => {\n  const params: Partial<Config> = {\n    Port: parseNumber(process.env.PORT) ?? 4009,\n    Secret: process.env.SECRET,\n    AccountsUrl: process.env.ACCOUNTS_URL,\n    ServiceID: process.env.SERVICE_ID,\n    DbURL: process.env.DB_URL\n  }\n\n  const missingEnv = (Object.keys(params) as Array<keyof Config>).filter((key) => params[key] === undefined)\n\n  if (missingEnv.length > 0) {\n    throw Error(`Missing config for attributes: ${missingEnv.join(', ')}`)\n  }\n\n  return params as Config\n})()\n\nexport default config\n","sourceCodeStart":20,"sourceCodeEnd":45,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/export/pod-export/src/config.ts#L20-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nDB_URL unset -> throw at import\n// after\n# .env\nDB_URL=postgres://user:pass@host:5432/exportdb","handlingStrategy":"validation","validationCode":"const required = ['DB_URL'];\nconst missing = required.filter((k) => !process.env[k]);\nif (missing.length) throw new Error(`Missing env vars: ${missing.join(', ')}`);\n// also sanity-check it parses as a URL\nnew URL(process.env.DB_URL!);","typeGuard":"function isSet(v: string | undefined): v is string {\n  return v !== undefined && v.length > 0;\n}","tryCatchPattern":"try {\n  const { default: config } = await import('./src/config.js');\n} catch (e) {\n  console.error(`Export service misconfigured: ${(e as Error).message}`);\n  process.exit(1);\n}","preventionTips":["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."],"tags":["environment","configuration","database","startup"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}