Dev Tools · 2h ago
Node-pg-migrate bug silently falls back to PG* env vars
A developer discovered that node-pg-migrate v6.2.2 successfully connected to a database even when the DATABASE_URL was empty, due to an undocumented fallback to PG* environment variables. The package's source code revealed it uses the pg library's default connection logic, which reads PG* vars when no explicit config is provided. This behavior can mask configuration errors and lead to unintended database connections.
Meridian48 take
The story highlights a subtle but dangerous pattern where libraries silently fall back to defaults, potentially hiding misconfigurations that could cause production issues.
Read the full reporting
When Code "Works" by Accident: Hunting Down an Undocumented Fallback in node-pg-migrate 🔍 →
DEV Community
node-pg-migrateundocumented-fallback