SupabaseS
Supabase2mo ago
Diego

What is the recommended drizzle client setup in edge functions?

I'm doing this:
import { drizzle } from 'npm:drizzle-orm/postgres-js';
import postgres from 'npm:postgres';

const connectionString = Deno.env.get('DATABASE_URL')!;
const postgres_client = postgres(connectionString, { prepare: false });
const postgres_db = drizzle(postgres_client);

The database url is initialized to the ipv4 compatible shared pooler and stored in that env variable

This works fine most of the time. However, I get timeout errors flakily. After digging a bit, turns out the initialization of the postgres client takes 150 seconds or so sometimes... My client times out

Is this a known issue? Has someone run into this, or what are recommendations to keep the initialization/connection time reliably low?
Was this page helpful?