{"record":{"id":"c6140c3f48107058","repo":"hcengineering/platform","slug":"missing-env-variables-missingenv-join-c6140c","errorCode":null,"errorMessage":"Missing env variables: ${missingEnv.join(', ')}","messagePattern":"Missing env variables: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"services/github/pod-github/src/config.ts","lineNumber":103,"sourceCode":"    ClientSecret: process.env[envMap.ClientSecret],\n    // https://github.com/octokit/auth-app.js/issues/465\n    PrivateKey: process.env[envMap.PrivateKey]?.replace(/\\\\n/g, '\\n'),\n    WebhookSecret: process.env[envMap.WebhookSecret] ?? 'secret',\n    EnterpriseHostname: process.env[envMap.EnterpriseHostname],\n    Port: parseInt(process.env[envMap.Port] ?? '3500'),\n    BotName: process.env[envMap.BotName] ?? 'ao-huly-dev[bot]',\n\n    CollaboratorURL: process.env[envMap.CollaboratorURL],\n\n    BrandingPath: process.env[envMap.BrandingPath] ?? '',\n    WorkspaceInactivityInterval: parseInt(process.env[envMap.WorkspaceInactivityInterval] ?? '3'), // In days\n    RateLimit: parseInt(process.env[envMap.RateLimit] ?? '25')\n  }\n\n  const missingEnv = required.filter((key) => params[key] === undefined).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":85,"sourceCodeEnd":110,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/github/pod-github/src/config.ts#L85-L110","documentation":"The github service config module (services/github/pod-github/src/config.ts) maps Config keys to env var names via an `envMap` and throws this error when any required parameter is undefined. Unlike the sibling services, it reports the raw env variable names (from envMap) rather than config keys, e.g. the value of envMap.RateLimit. It is a fail-fast import-time validation.","triggerScenarios":"One or more env vars listed in `required` are undefined when config.ts is imported; params[key] === undefined for such keys, e.g. envMap.RateLimit's backing variable missing (RateLimit itself defaults via parseInt ?? '25', so it would only fail if its env var is in the required set and unset for other keys).","commonSituations":"GitHub integration pod deployed without its required GitHub App credentials/env; env var renamed in envMap but not updated in deployment; running locally without a complete .env.","solutions":["Set each env variable named in the error message (they are the envMap names) in the runtime environment.","Cross-check envMap in config.ts to map each reported name back to its Config key and its intended value format.","If a variable should be optional, move it out of `required` or give it a default in the params object.","Validate the full env locally by importing the config module in a script before deploying."],"exampleFix":"// before\nGITHUB_APP_ID unset -> \"Missing env variables: GITHUB_APP_ID\"\n// after\n# .env\nGITHUB_APP_ID=123456","handlingStrategy":"validation","validationCode":"// Mirror the envMap required list from services/github/pod-github/... config.ts\nconst required: string[] = [/* envMap values */];\nconst missing = required.filter((k) => process.env[k] === undefined);\nif (missing.length) throw new Error(`Missing env variables: ${missing.join(', ')}`);","typeGuard":"function hasAllEnv(keys: string[]): keys is string[] {\n  return keys.every((k) => process.env[k] !== undefined);\n}","tryCatchPattern":"try {\n  const { default: config } = await import('./src/config.js');\n} catch (e) {\n  if ((e as Error).message.startsWith('Missing env variables')) {\n    console.error('Set these GitHub service env vars:', (e as Error).message);\n  }\n  process.exit(1);\n}","preventionTips":["Keep the `required` array and your deployment env template in sync; diff on upgrades.","Use one secret group per service so new vars ship with the release.","Add an env lint step in CI comparing required vars against the K8s manifest."],"tags":["environment","configuration","startup"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}