1

I have an express app and am using massive to connect to a postgres db. I recently upgraded node to v14 and it is no longer working. When I roll back to node v13.11.0 it works fine. When I run this code to connect to the db:

// DATABASE CONNECTION
massive(DATABASE_URL)
   .then(db => {
      app.set('db', db)
      console.log(('Connected to database'));
      app.listen(port, () => {
         console.log(`Listening on port: ${port}`);
      })
   })
   .catch(err => console.log(err));

I get this error:

[nodemon] starting `node ./server/server.js`
Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1485:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:928:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12) {
  code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
}
[nodemon] clean exit - waiting for changes before restart

I have ?ssl=true appended to the connection string.

Does anyone else have issues with this or know a way to fix this? I am aware I can set an environment variable to allow all connections but I'd rather keep this secure. Thanks in advance!

motogoozy
  • 11
  • 1
  • Did you figure this out, I'm having a similar issue upgrading from v12 to v14. – Kamilski81 Mar 19 '21 at 17:33
  • It’s been a while but if I remember right, the ‘massive’ package had a dependency that made a breaking change with node v14. I think the broken dependency was ‘pg-promise’. So I just rolled back to node v13.11. I believe the package author has since released a patch for the issue though. – motogoozy Mar 20 '21 at 18:12

0 Answers0