SELF_SIGNED_CERT_IN_CHAIN error while running `npx drizzle-kit studio`
08:16 08 May 2026

I am setting up Drizzle ORM in my Next.js website. This is the drizzle.config.json file:

import "dotenv/config";
import { defineConfig } from "drizzle-kit";

export default defineConfig({
  out: "./drizzle",
  schema: "./src/db/schema.ts",
  dialect: "postgresql",
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
});

I created a Supabase database from Vercel. It gave me the following variables:

POSTGRES_URL="postgres://:@aws-1-us-east-1.pooler.supabase.com:6543/postgres?sslmode=require&supa=base-pooler.x"

POSTGRES_URL_NON_POOLING="postgres://:@aws-1-us-east-1.pooler.supabase.com:5432/postgres?sslmode=require"

I tried using each one as DATABASE_URL, but it is throwing the following error in both cases:

Error: self-signed certificate in certificate chain
code: 'SELF_SIGNED_CERT_IN_CHAIN'

The error is thrown not only when I try to run npx drizzle-kit studio, but also when I try to do anything with the db instance. I haven't deployed this yet. I found out that adding the following configuration to drizzle.config.ts would fix the issue:

ssl: { rejectUnauthorized: false }

But this is probably not safe for production. I tried many other methods as well, but nothing seems to be working. Can someone help me fix the issue?

postgresql next.js supabase drizzle drizzle-kit