supabase / postgres-meta

A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries
https://supabase.com
Apache License 2.0
863 stars 112 forks source link

sslmode=require ignored on postgresql URL with gen types --db-url #719

Closed humphd closed 5 months ago

humphd commented 5 months ago

I'm trying to generate types from a remote postgres database:

$ supabase gen types typescript --db-url "postgresql://user:password@some-db.us-east-1.aws.neon.tech/db?sslmode=require"

Connecting to some-db.us-east-1.aws.neon.tech
(node:1) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
file:///usr/src/app/dist/server/server.js:57
        throw new Error(schemasError.message);
              ^

Error: connection is insecure (try using `sslmode=require`)
    at file:///usr/src/app/dist/server/server.js:57:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

However, I've included ?sslmode=require. Is there a different way I should be doing this?

sweatybridge commented 5 months ago

I checked pgmeta and realised that we are not passing down the sslmode param from url string. I will fix this in the upcoming beta release 1.144.4.

humphd commented 5 months ago

This is great, thank you for fixing it so quickly, @sweatybridge! Looking forward to using it.

sweatybridge commented 5 months ago

When I tested this earlier on, the env var PG_META_DB_SSL_MODE doesn't appear to affect anything. @soedirgo could you help confirm if this works?