Supabase + Drizzle + Nuxt 3 + Node - SSL 'SELF_SIGNED_CERT_IN_CHAIN' and drizzle-kit studio issues

Hi everyone ๐Ÿ‘‹

I'm new to drizzle, and fairly new to supabase but have it up and running and fetching data ok.

SSL issue
As my project grows, I wanted to try drizzle to have a better dx and how I handle database now. I'm using Supabase with Nuxt 3 and Node and not off to a great start, I see
code: 'SELF_SIGNED_CERT_IN_CHAIN'
error. Here's my configuration
// drizzle.config.ts

import 'dotenv/config';

import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './server/db/schema.ts',
  out: './server/supabase/migrations',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
});

//db.ts

import 'dotenv/config';

import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';

const connectionString = process.env.DATABASE_URL as string;

export const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);

# .env file

SUPABASE_URL="mysupabaseurl"
SUPABASE_KEY="mysupabasekey"

DATABASE_URL="postgres://postgres.[YOUR-USERNAME]:[YOUR-PASSWORD]@aws-0-eu-west-2.pooler.supabase.com:6543/postgres?sslmode=no-verify"

NODE_EXTRA_CA_CERTS="./server/certs/prod-ca-2021.crt"


I've looked and tried solutions from the links below to no avail:
https://github.com/drizzle-team/drizzle-orm/discussions/881
https://github.com/orgs/supabase/discussions/18710

In Supabase I have
Enforce SSL on incoming connections - Reject non-SSL connections to your database
enabled, downloaded the right certificate from Supabase and place it in the right folder.

If I disable the SSL in Supabase (and remove
?sslmode=no-verify
and
NODE_EXTRA_CA_CERTS="./server/certs/prod-ca-2021.crt"
from my
.env
file I am able to migrate/push data - however I prefer SSL to be on the safe side (what are the implications of having SSL off?)

Drizzle studio
It seems to be stuck on the spinner - why? Attached gif.

Cheers!
Screen_Recording_2024-06-01_at_4.41.50_PM.gif
GitHub
Hello, I am a new user of drizzle and trying to run the command for the first time to connect to my Supabase instance: drizzle-kit introspect:pg But I got this error [โฃŸ] 0 tables fetching [โฃŸ] 0 col...
GitHub
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...
Was this page helpful?