{"record":{"id":"7c56cd9e2efdf8bb","repo":"hcengineering/platform","slug":"missing-env-variables-missingenv-join-7c56cd","errorCode":null,"errorMessage":"Missing env variables: ${missingEnv.join(', ')}","messagePattern":"Missing env variables: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"services/translate/src/config.ts","lineNumber":50,"sourceCode":"\nconst config: Config = (() => {\n  const params: Partial<Config> = {\n    Secret: process.env.SECRET ?? 'secret',\n    QueueConfig: process.env.QUEUE_CONFIG ?? '',\n    QueueRegion: process.env.QUEUE_REGION ?? '',\n    AccountsUrl: process.env.ACCOUNTS_URL ?? '',\n    HulylakeUrl: process.env.HULYLAKE_URL ?? '',\n    ServiceId: process.env.SERVICE_ID ?? 'translate',\n    OpenAIKey: process.env.OPENAI_API_KEY,\n    OpenAIModel: (process.env.OPENAI_MODEL ?? 'gpt-4o-mini') as OpenAI.ChatModel,\n    OpenAIBaseUrl: process.env.OPENAI_BASE_URL ?? '',\n    BillingUrl: process.env.BILLING_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 env variables: ${missingEnv.join(', ')}`)\n  }\n\n  return params as Config\n})()\n\nexport default config\n","sourceCodeStart":32,"sourceCodeEnd":57,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/translate/src/config.ts#L32-L57","documentation":"The translate service config module reads required environment variables at load time and throws immediately if any are missing or empty, failing fast rather than running with an incomplete configuration.","triggerScenarios":"Starting the translate service without BILLING_URL (or any other required variable) set in the environment, or exporting it as an empty string.","commonSituations":"Deploying without the variable in the deployment config; .env file not loaded locally; variable renamed between versions so old deployments lack it.","solutions":["Set all required env variables (e.g. BILLING_URL) in the service environment and restart","Add the missing variables to your .env file / deployment secret configuration","Compare against the current config.ts to find variables added since your deployment was created","Add a startup healthcheck that surfaces this message early in CI/deploy"],"exampleFix":"// before\n# start service with missing config\nyarn start translate\n// after\nexport BILLING_URL=https://billing.example.com\nyarn start translate","handlingStrategy":"validation","validationCode":"const required = ['BILLING_URL', 'ACCOUNTS_URL', 'MONGO_URL']\nconst missing = required.filter(k => !process.env[k])\nif (missing.length > 0) throw new Error(`Missing env variables: ${missing.join(', ')}`)","typeGuard":null,"tryCatchPattern":"try {\n  await import('./config')\n} catch (err) {\n  if (String(err.message).startsWith('Missing env variables:')) {\n    console.error('Startup failed:', err.message)\n    process.exit(1)\n  }\n}","preventionTips":["Keep deployment secrets/env files in sync with config.ts","Fail fast in CI by importing config during smoke tests","Document every required variable and validate empty strings as missing"],"tags":["config","environment","startup"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}