pg, Postgres, and Node 14 Connection Errors
November 13, 2020
Since updating to Node 14, none of my apps with a Postgres database will not connect anymore. I’ve run into this issue twice now…shame on me for not documenting the first time around! So I will troubleshoot again…
Why
Some sleuthing reveals a database connection error…not sure why but my database error handling isn’t throwing errors. This issue suggests the issue is with pg
rather than Postgres or Sequelize.
The Fix
- Update
pg
to latest version. Minimal requirement is8.0.3
but as of now, the latest is8.5.1
👀 - Now at least a connection error throws:
Unable to connect to the database: ConnectionError [SequelizeConnectionError]: self signed certificate
- This issue confirms an issue with
pg
and provides some additional settings to add to the database config:
dialectOptions: { |
And voila! Problem solved.