{"record":{"id":"306fcb51089dad54","repo":"hcengineering/platform","slug":"missing-config-for-attributes-missingenv-join-306fcb","errorCode":null,"errorMessage":"Missing config for attributes: ${missingEnv.join(', ')}","messagePattern":"Missing config for attributes: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"services/telegram-bot/pod-telegram-bot/src/config.ts","lineNumber":57,"sourceCode":"    AccountsUrl: process.env.ACCOUNTS_URL,\n    ServiceId: process.env.SERVICE_ID ?? 'telegram-bot',\n    Secret: process.env.SECRET,\n    Domain: process.env.DOMAIN ?? '',\n    BotPort: parseNumber(process.env.BOT_PORT) ?? 8443,\n    // TODO: later we should get this title from branding map\n    App: process.env.APP ?? 'Huly',\n    OtpTimeToLiveSec: parseNumber(process.env.OTP_TIME_TO_LIVE_SEC) ?? 5 * 60,\n    OtpRetryDelaySec: parseNumber(process.env.OTP_RETRY_DELAY_SEC) ?? 60,\n    AccountsURL: process.env.ACCOUNTS_URL,\n    DbUrl: process.env.DB_URL,\n    QueueRegion: process.env.QUEUE_REGION,\n    QueueConfig: process.env.QUEUE_CONFIG\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":39,"sourceCodeEnd":64,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/telegram-bot/pod-telegram-bot/src/config.ts#L39-L64","documentation":"The pod-telegram-bot service validates its Config at startup inside a module IIFE and throws if any parameter (including QueueConfig from QUEUE_CONFIG) is undefined. Unlike some sibling services it has no required filtering or defaults here, so every undefined key triggers the error.","triggerScenarios":"Starting pod-telegram-bot without QUEUE_CONFIG or any other bot env variable (telegram token, endpoint, secret) set; env vars not propagated into the container.","commonSituations":"Kubernetes secrets not mounted, docker-compose env missing, .env file absent, typos in variable names, or upgrades introducing new required config keys.","solutions":["Set the missing variables named in the error and restart the pod.","Define QUEUE_CONFIG as a valid queue connection string/JSON.","Check services/telegram-bot/pod-telegram-bot/src/config.ts for the full key list and expected env names.","For optional keys, add ?? defaults in the params object."],"exampleFix":"// before\n# no QUEUE_CONFIG\n// after\nQUEUE_CONFIG={\"host\":\"rabbitmq\",\"port\":5672}\nTELEGRAM_TOKEN=123456:ABC-DEF","handlingStrategy":"validation","validationCode":"const required = ['QUEUE_CONFIG', 'TELEGRAM_TOKEN', 'SECRET'] // mirror config.ts\nconst missing = required.filter((k) => process.env[k] === undefined)\nif (missing.length > 0) throw new Error(`pod-telegram-bot missing env: ${missing.join(', ')}`)","typeGuard":"function hasEnv(keys: string[]): boolean { return keys.every((k) => process.env[k] !== undefined) }","tryCatchPattern":"try {\n  await import('./config.js')\n} catch (err) {\n  if (err.message.startsWith('Missing config for attributes:')) {\n    console.error('Set bot env vars and restart:', err.message)\n    process.exit(1)\n  }\n  throw err\n}","preventionTips":["Define QUEUE_CONFIG as valid queue connection config before deploy.","Mount the telegram bot token via secrets; verify with kubectl describe pod.","Add an env validation step in the deploy pipeline.","Keep .env.example updated when Config keys change."],"tags":["config","environment","startup","telegram-bot"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}