hcengineering/platform · critical · Error
QUEUE_CONFIG env var is not set
Error message
QUEUE_CONFIG env var is not set
What it means
In services/mail/pod-mail-worker/src/config.ts, queueConfig is resolved by an inline IIFE that returns process.env.QUEUE_CONFIG when defined and otherwise throws this error. The worker needs queue settings to send/receive mail events, so a missing QUEUE_CONFIG stops the process at import time.
Source
Thrown at services/mail/pod-mail-worker/src/config.ts:63
return process.env.WORKSPACE_URL
}
throw Error('WORKSPACE_URL env var is not set')
})(),
ignoredAddresses: process.env.IGNORED_ADDRESSES?.split(',') ?? [],
hookToken: process.env.HOOK_TOKEN,
mailSizeLimit: process.env.MAIL_SIZE_LIMIT ?? '50mb',
storageConfig: process.env.STORAGE_CONFIG,
kvsUrl: (() => {
if (process.env.KVS_URL !== undefined) {
return process.env.KVS_URL
}
throw Error('KVS_URL env var is not set')
})(),
queueConfig: (() => {
if (process.env.QUEUE_CONFIG !== undefined) {
return process.env.QUEUE_CONFIG
}
throw Error('QUEUE_CONFIG env var is not set')
})(),
queueRegion: process.env.QUEUE_REGION ?? '',
communicationTopic: process.env.COMMUNICATION_TOPIC ?? 'hulygun',
serviceId: process.env.SERVICE_ID ?? 'huly-mail',
mailUrl: (() => {
if (process.env.MAIL_URL !== undefined) {
return process.env.MAIL_URL
}
throw Error('MAIL_URL env var is not set')
})(),
mailAuth: process.env.MAIL_AUTH ?? '',
footerMessage: process.env.FOOTER_MESSAGE ?? '<br><br><p>Sent via <a href="https://huly.io">Huly</a></p>',
outgoingSyncStartDate: new Date(process.env.OUTGOING_SYNC_START_DATE ?? '2025-08-20T00:00:00.000Z')
}
export default config
View on GitHub (pinned to 63e28dc964)
Solutions
- Set QUEUE_CONFIG (usually a JSON string with queue URL/region/credentials) in the worker's environment.
- Validate the JSON parses before deploying; downstream consumers typically JSON.parse this value.
- Mirror the production QUEUE_CONFIG in your local .env for development.
- Check the message queue itself is provisioned and reachable with the given config.
Example fix
// before
QUEUE_CONFIG unset -> throw at import
// after
# .env
QUEUE_CONFIG={"queueUrl":"https://sqs.us-east-1.amazonaws.com/123/mail","region":"us-east-1"} Defensive patterns
Strategy: validation
Validate before calling
const required = ['QUEUE_CONFIG', 'WORKSPACE_URL', 'KVS_URL', 'MAIL_URL'];
const missing = required.filter((k) => process.env[k] === undefined);
if (missing.length) {
console.error('Missing mail-worker env vars:', missing.join(', '));
process.exit(1);
}
JSON.parse(process.env.QUEUE_CONFIG!); // must be valid JSON Type guard
function isDefined<T>(v: T | undefined): v is T {
return v !== undefined;
} Try / catch
try {
const { default: config } = await import('./src/config.js');
} catch (e) {
if ((e as Error).message === 'QUEUE_CONFIG env var is not set') {
console.error('Configure QUEUE_CONFIG with the queue connection settings JSON');
}
process.exit(1);
} Prevention
- Store QUEUE_CONFIG as a structured secret and validate its JSON schema in CI.
- Provision the queue alongside the worker in infrastructure-as-code.
- Add a startup check that connects to the queue using the parsed config.
When it happens
Trigger: process.env.QUEUE_CONFIG is undefined when config.ts is first imported. Empty string would pass this specific check (only `!== undefined` is tested).
Common situations: Queue config secret not mounted; queue infra (e.g. SQS/RabbitMQ settings JSON) not provisioned for the mail worker; local run without the queue section in .env.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Please provide queue config
- Missing config for attributes: ${missingEnv.join(', ')}
- Missing config for attributes: ${missingEnv.join(', ')}
- Missing env variables: ${missingEnv.join(', ')}
- Missing env variables: ${missingEnv.join(', ')}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/822d395ae46c4c94.
Report an issue: GitHub.