{"record":{"id":"456a6d78e85a1561","repo":"hcengineering/platform","slug":"missing-env-variable-queue-config","errorCode":null,"errorMessage":"Missing env variable: QUEUE_CONFIG","messagePattern":"Missing env variable: QUEUE_CONFIG","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"services/gmail/pod-gmail/src/config.ts","lineNumber":96,"sourceCode":"    KvsUrl: process.env[envMap.KvsUrl],\n    StorageConfig: process.env[envMap.StorageConfig],\n    Version: version,\n    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":78,"sourceCodeEnd":107,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/gmail/pod-gmail/src/config.ts#L78-L107","documentation":"In the gmail service config module (services/gmail/pod-gmail/src/config.ts), when the integration version is V2 and params.QueueConfig is an empty string, this dedicated error is thrown. It exists because an empty QUEUE_CONFIG passes the generic undefined check but is still unusable for V2 queue-based message flow, so the config module fails fast with a precise message.","triggerScenarios":"IntegrationVersion.V2 active AND process.env.QUEUE_CONFIG is set to an empty string (QUEUE_CONFIG=\"\" in the environment or an empty value in the manifest/.env). Undefined QUEUE_CONFIG instead surfaces in error 1233's list.","commonSituations":"Migrating a V1 Gmail integration to V2 without provisioning the queue config; deployment template renders QUEUE_CONFIG as empty; queue credentials removed from secrets during rotation.","solutions":["Provide a valid, non-empty QUEUE_CONFIG value (typically a JSON string with queue connection settings) in the environment.","Verify with `printenv QUEUE_CONFIG | wc -c` (or equivalent) that it is not empty after deployment.","If the integration should remain V1, ensure the version flag actually selects V1 so this check is skipped.","Regenerate/recreate the queue config (SQS/queue URL and credentials) and inject it via the secret manager."],"exampleFix":"// before\nQUEUE_CONFIG=\"\"\n// after\n# .env\nQUEUE_CONFIG={\"queueUrl\":\"https://sqs.us-east-1.amazonaws.com/123/gmail\",\"region\":\"us-east-1\"}","handlingStrategy":"validation","validationCode":"if (isV2) {\n  const q = process.env.QUEUE_CONFIG;\n  if (q === undefined || q.trim() === '') {\n    throw new Error('Missing env variable: QUEUE_CONFIG');\n  }\n  JSON.parse(q); // must be valid queue config JSON\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: QUEUE_CONFIG') {\n    console.error('Provide a non-empty QUEUE_CONFIG for V2 integrations');\n  }\n  process.exit(1);\n}","preventionTips":["Set QUEUE_CONFIG via a secret, never as an empty placeholder in templates.","Add a readiness check that JSON.parses QUEUE_CONFIG before serving traffic.","Verify rendered manifests (helm/kustomize) do not produce empty values."],"tags":["environment","configuration","queue","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"}