Error: self-signed certificate in certificate chain when using Supabase connection string

I’m trying to connect my Node app to Supabase Postgres on Fly.io.

My app has a DATABASE_URL env var set to: postgres://postgres:[password]@db.[project-id].supabase.co:5432/postgres?sslmode=require as per instructions from the setup.

EDIT: after closer look, the docs actually reccomend sslmode=disable, which fixes the issue. I guess it makes sense because this is a part of internal network? I’m a bit confused where the Supabase postgres actually lives given the non-internal-looking url (no .flycast), so I will leave the question open until someone smarter offers a better explanation.

Previous error caused by attempting to connect over TLS:

Error: self-signed certificate in certificate chain
  at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
  at TLSSocket.emit (node:events:524:28)
  at TLSSocket._finishInit (node:_tls_wrap:1078:8)
  at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:864:12) {
    code: 'SELF_SIGNED_CERT_IN_CHAIN'
}

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