Drizzle ORM + Supabase Enforce SSL

I'm trying to connect with a direct pool connection (transaction mode). I'm deploying to Supabase Deno functions. This is my URL: postgres://postgres.{user}:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:6543/postgres const client = postgres(url, { prepare: false }); const db = drizzle(client); Supabase returns "SSL connection is required" I tried appending the sslmode in the url, but nothing has worked. ?sslmode=no-verify,strict,verify-full etc. How can I connect to Supabase with Drizzle using SSL?
4 Replies
[object Object]
[object Object]6mo ago
GitHub
Any advice on connecting to supabase when SSL is enabled? · supabas...
I am using drizzle and drizzle-kit to run migrations against my supabase DB. I have SSL enforced, and can connect via psql (both with and without the SSL CLI flags, this doesn't make sense to m...
luis
luisOP6mo ago
Thanks! I saw this, but the edge function is deployed to supabase. As far as I understand, the edge functions are already pre-configured: https://supabase.com/docs/guides/functions/connect-to-postgres#ssl-connections
Supabase
Connecting directly to Postgres | Supabase Docs
Connecting to Postgres from Edge Functions.
luis
luisOP6mo ago
I tried the Deno Postgres client. It works in Supabase Edge Functions without any additional config. https://github.com/denodrivers/postgres The Postgres client used by Drizzle might not be picking up the TLS config. const client = new Client({ user: "z", database: "postgres", hostname: "aws-0-us-west-1.pooler.supabase.com", port: 6543, password: "z", }); await client.connect(); const result = await client .queryArray'SELECT ID FROM table WHERE ID = 1'; console.log(result.rows);
GitHub
GitHub - denodrivers/postgres: PostgreSQL driver for Deno
PostgreSQL driver for Deno. Contribute to denodrivers/postgres development by creating an account on GitHub.
luis
luisOP6mo ago
Adding NODE_EXTRA_CA_CERTS="./server/certs/prod-ca-2021.crt" to the envs didn't work: I got this error in the edge function: path not found server/certs/prod-ca-2021.crt: readfile './server/certs/prod-ca-2021.crt'
Want results from more Discord servers?
Add your server