SupabaseS
Supabase6mo ago
dan

certificate issue with database branching and ssl

Hi, I'm trying to configure a project with database branching using the vercel integration. I've got two persistent branches (main and dev) where preview envs are branched off of dev. For some reason, the default postgres_url setup via the integration causes an ssl error SELF_SIGNED_CERT_IN_CHAIN

my config for reference
import { Pool } from "pg";

const postgresConfig = {
  connectionString: process.env.POSTGRES_URL,
};

const config = {
  ...(postgresConfig?.connectionString?.includes("localhost")
    ? {}
    : {
        ssl: {
          rejectUnauthorized: true,
          ca: Buffer.from(process.env.POSTGRES_SSL_CA!, "base64").toString("utf-8"),
        },
      }),
  ...postgresConfig,
};

const pool = new Pool(config);

export default pool;
Was this page helpful?