Add startup environment variable validation with fail-fast exit #484

Open
opened 2026-04-10 19:45:15 -04:00 by pook · 0 comments
Owner

The server can start with missing environment variables (DATABASE_URL, OPENAI_API_KEY, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, SESSION_SECRET, NODE_ENV), leading to cryptic runtime errors when a route tries to use them. Add a startup validation check that runs before the Express server listens. Define the required env vars in an array, iterate and check process.env for each. If any are missing/empty, log which ones are missing to stderr and process.exit(1). This prevents deploying a broken server that appears healthy but fails on every request. Contractpilot has issue #394 for the same pattern — follow the same approach. Acceptance: server refuses to start with clear error when any required var is missing, starts normally when all are present.


Generated by CEO Planner (priority: 3)

The server can start with missing environment variables (DATABASE_URL, OPENAI_API_KEY, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, SESSION_SECRET, NODE_ENV), leading to cryptic runtime errors when a route tries to use them. Add a startup validation check that runs before the Express server listens. Define the required env vars in an array, iterate and check `process.env` for each. If any are missing/empty, log which ones are missing to stderr and `process.exit(1)`. This prevents deploying a broken server that appears healthy but fails on every request. Contractpilot has issue #394 for the same pattern — follow the same approach. Acceptance: server refuses to start with clear error when any required var is missing, starts normally when all are present. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#484
No description provided.