{"record":{"id":"8e15db1a41554f32","repo":"hcengineering/platform","slug":"missing-env-variables-missingenv-join-8e15db","errorCode":null,"errorMessage":"Missing env variables: ${missingEnv.join(', ')}","messagePattern":"Missing env variables: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"services/calendar/pod-calendar/src/config.ts","lineNumber":62,"sourceCode":"const config: Config = (() => {\n  const params: Partial<Config> = {\n    Port: parseNumber(process.env[envMap.Port]) ?? 8095,\n    AccountsURL: process.env[envMap.AccountsURL],\n    ServiceID: process.env[envMap.ServiceID] ?? 'calendar-service',\n    Secret: process.env[envMap.Secret],\n    Credentials: process.env[envMap.Credentials],\n    InitLimit: parseNumber(process.env[envMap.InitLimit]) ?? 50,\n    WATCH_URL: process.env[envMap.WATCH_URL],\n    KvsUrl: process.env[envMap.KvsUrl],\n    WorkspaceInactivityInterval: parseNumber(process.env[envMap.WorkspaceInactivityInterval] ?? '3') // In days\n  }\n\n  const missingEnv = (Object.keys(params) as Array<keyof Config>)\n    .filter((key) => params[key] === undefined)\n    .map((key) => envMap[key])\n\n  if (missingEnv.length > 0) {\n    throw Error(`Missing env variables: ${missingEnv.join(', ')}`)\n  }\n\n  return params as Config\n})()\n\nexport default config\n","sourceCodeStart":44,"sourceCodeEnd":69,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/calendar/pod-calendar/src/config.ts#L44-L69","documentation":"The pod-calendar config IIFE builds params from env vars and throws 'Missing env variables' (reporting the mapped env-var names via envMap) when any param is undefined. Port, ServiceID, InitLimit and WorkspaceInactivityInterval have defaults, so the throw comes from ACCOUNTS_URL, SECRET, Credentials, WATCH_URL, or KVS_URL being unset.","triggerScenarios":"Importing services/calendar/pod-calendar/src/config.ts without one of: ACCOUNTS_URL, SECRET, Credentials, WATCH_URL, KVS_URL. The message reports env-var names (e.g. 'Credentials, WATCH_URL'). Note the credentials env var is literally 'Credentials' (mixed case) per envMap.","commonSituations":"Deploying calendar service without Google/Calendar API credentials; missing KVS or watch URL after infrastructure changes; secret not mounted; typo like CREDENTIALS (uppercase) instead of Credentials.","solutions":["Set the env vars named in the message — typically ACCOUNTS_URL, SECRET, Credentials, WATCH_URL, KVS_URL.","Check the env key is exactly 'Credentials' (mixed case) — a case typo causes this error.","Verify k8s Secret/ConfigMap mounts contain all calendar-related keys.","Create a local .env with these vars before running the pod."],"exampleFix":"// before\nexport CREDENTIALS=$CREDS  # wrong case; WATCH_URL also missing\n// after\nexport Credentials=$(cat google-creds.json)\nexport WATCH_URL=https://calendar.example.com/watch\nexport KVS_URL=https://kvs.example.com\nexport SECRET=...\nexport ACCOUNTS_URL=https://accounts.example.com","handlingStrategy":"validation","validationCode":"const missing = ['ACCOUNTS_URL','SECRET','Credentials','WATCH_URL','KVS_URL'].filter((k) => process.env[k] === undefined)\nif (missing.length > 0) throw new Error(`Missing env variables: ${missing.join(', ')}`)","typeGuard":"function hasEnv(key: string): boolean {\n  return process.env[key] !== undefined\n}","tryCatchPattern":"try {\n  const { default: config } = await import('./config.js')\n} catch (err) {\n  if ((err as Error).message.startsWith('Missing env variables:')) {\n    console.error('calendar config error:', err.message)\n    process.exit(1)\n  }\n  throw err\n}","preventionTips":["Remember the credentials key is 'Credentials' (mixed case) — avoid the CREDENTIALS typo.","List all five required vars in .env.example for pod-calendar.","Verify WATCH_URL and KVS_URL endpoints exist before deployment.","Add a startup preflight that checks env presence and key casing."],"tags":["configuration","environment-variables","calendar"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}