Nodejs self signed certificate error postgres

I have a POSTGRES and web service (using nodejs, express, and pg) instance hosted on Render. I have a db pool set up on my web service:

const pool = new Pool({
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    host: process.env.DB_HOST,
    port: process.env.DB_PORT || 5432,
    database: process.env.DB_NAME,
    ssl: true
})

When I run the nodejs app locally, I am able to hit my dev postgres instance successfully. However, when I deploy me web service to dev and use the dev webservice url it starts failing.
This is an example health check error that I get:

Health check failed: Error: self-signed certificate
    at /opt/render/project/src/node_modules/pg-pool/index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///opt/render/project/src/routes/index.js:15:24 {
  code: 'DEPTH_ZERO_SELF_SIGNED_CERT'

Now, when I remove ssl:true from the pool creation, dev works but local stops working. Any ideas of why this is happening? Also, after looking at other forum posts I do want to clarify that I am using the external credentials for my local envs and the internal credentials for my dev envs

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.