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!

4

0 に答える 0