{"record":{"id":"201e57af51ceee95","repo":"hcengineering/platform","slug":"missing-env-variable-communication-topic","errorCode":null,"errorMessage":"Missing env variable: COMMUNICATION_TOPIC","messagePattern":"Missing env variable: COMMUNICATION_TOPIC","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"services/gmail/pod-gmail/src/config.ts","lineNumber":99,"sourceCode":"    QueueConfig: process.env[envMap.QueueConfig] ?? '',\n    QueueRegion: process.env[envMap.QueueRegion] ?? '',\n    CommunicationTopic: process.env[envMap.CommunicationTopic] ?? 'hulygun',\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  if (version === IntegrationVersion.V2) {\n    if (params.QueueConfig === '') {\n      throw Error('Missing env variable: QUEUE_CONFIG')\n    }\n    if (params.CommunicationTopic === '') {\n      throw Error('Missing env variable: COMMUNICATION_TOPIC')\n    }\n  }\n\n  return params as Config\n})()\n\nexport default config\n","sourceCodeStart":81,"sourceCodeEnd":107,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/gmail/pod-gmail/src/config.ts#L81-L107","documentation":"In the gmail service config module (services/gmail/pod-gmail/src/config.ts), when the integration is V2 and params.CommunicationTopic is an empty string, this error is thrown. V2 integrations require a communication topic for inter-service messaging; an empty value passes the generic undefined check, so this explicit check catches it with a targeted message.","triggerScenarios":"IntegrationVersion.V2 active AND process.env.COMMUNICATION_TOPIC is set but empty (COMMUNICATION_TOPIC=\"\"). A truly undefined value instead appears in the missingEnv list of error 1233.","commonSituations":"V2 migration where the topic ARN/name was never provisioned; empty placeholder in deployment template; topic removed during infra cleanup while the service still references it.","solutions":["Set COMMUNICATION_TOPIC to the correct topic name/ARN in the service environment.","Confirm the topic exists in the messaging infrastructure and the pod's credentials can access it.","If V2 behavior is unintended, correct the version configuration so the V2 checks are skipped.","Add a startup smoke test importing config.ts to catch empty-string envs before deploy."],"exampleFix":"// before\nCOMMUNICATION_TOPIC=\"\"\n// after\n# .env\nCOMMUNICATION_TOPIC=arn:aws:sns:us-east-1:123:communication","handlingStrategy":"validation","validationCode":"if (isV2) {\n  const t = process.env.COMMUNICATION_TOPIC;\n  if (t === undefined || t.trim() === '') {\n    throw new Error('Missing env variable: COMMUNICATION_TOPIC');\n  }\n}","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  const { default: config } = await import('./src/config.js');\n} catch (e) {\n  if ((e as Error).message === 'Missing env variable: COMMUNICATION_TOPIC') {\n    console.error('Provide a non-empty COMMUNICATION_TOPIC for V2 integrations');\n  }\n  process.exit(1);\n}","preventionTips":["Provision the communication topic as part of V2 infrastructure-as-code.","Assert topic existence with a startup check (describe/create-if-missing).","Avoid empty-string defaults in deployment templates for V2-required vars."],"tags":["environment","configuration","messaging","gmail","v2-migration"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}