A missing line in .env.example took down our prod, so I built a PR check for it
Описание и применение
Отсутствие строки в .env.example привело к сбою продакшена, поэтому автор создал инструмент deployhealth, который автоматически проверяет использование переменных окружения, сравнивает их с .env.example и сообщает о недостающих переменных в PR‑чеках, CLI‑сканировании и мониторинге доступности.
Задача
A missing environment variable caused a production outage after a deploy, and existing safety nets failed to catch it.
Результат
Deployhealth prevents missing env var outages by automating detection and reporting, reducing manual debugging time from hours to seconds.
Рабочий процесс
- Scan repository for env var usage in code
- Compare found vars against .env.example and .env files
- In PRs, comment on new env var usage and missing declarations
- Flag committed .env files with potential leaked keys
- Run CLI scan on every push to report unused or missing vars
- Monitor uptime to detect failures linked to recent deploys and report introduced missing vars
Доказательства
The cause was an env var. The change read a new variable that existed on the developer's machine but had never been added to .env.example or to production.
Validate env vars at startup. t3-env, envalid or a small zod schema make the app fail on boot with a clear message, instead of on the first request with a mystery 500.
It started as envcheck, a small scanner that finds every env var your code reads and compares them with your env files. Pull request checks and uptime monitoring grew around it, and it became deployhealth.
Acme API started failing 4m after deploy b52952e, which introduced 2 missing env vars: REDIS_URL, STRIPE_KEY
- Дата записи: 2026-10-06T16:41:00.374Z