evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.43k stars 213 forks source link

[Bug]: Postgres SSL options are not correctly read from Environment Variables #2524

Open archiewood opened 2 months ago

archiewood commented 2 months ago

Describe the bug

When deploying an app with a postgres connection with no ssl certificates, the sources process fails.

Reported on Slack

Steps to Reproduce

connection.yaml image

.env image

I also tested with sslmode=require and without rejectUnauthorized line.

Logs

[ ! ] Error connecting to datasource [sourcename]: self-signed certificate in certificate chain

Workaround

To get around this in the meantime, and get your dev project to pass the build, commenting out the two ssl vars that you provide to Evidence Cloud should do (as the values in your connection.yaml values for these will kick in instead).

i.e copy your vars as usual, but prepend these two with a # , or remove them entirely

# EVIDENCE_SOURCE__postgres__ssl__sslmode="..."
# EVIDENCE_SOURCE__postgres__ssl__rejectUnauthorized="..."
ud3sh commented 2 months ago

I don't know if this is still the case anymore but I recall once being able to write a test while that showed boolean env vars set to "false" were being picked up as true.

See https://github.com/evidence-dev/evidence/pull/1993/files