Open samducker opened 1 year ago
Isn't node-pg relying on node? Edge/cloudflare is a non node runtime.
You could switch to postgres.js https://github.com/porsager/postgres
I was just following the instructions from the official doc related to cloudflare worker which is also edge.
I will try this!
On Sat, Oct 28 2023 at 8:54 am, Raphaël Moreau < @.*** > wrote:
Isn't node-pg relying on node? Edge/cloudflare is a non node runtime.
You could switch to postgres.js https://github.com/porsager/postgres
— Reply to this email directly, view it on GitHub ( https://github.com/drizzle-team/drizzle-orm/issues/1424#issuecomment-1783739142 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AF7VYSYGD5CORCA57HGLKJDYBS233AVCNFSM6AAAAAA6REST7OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBTG4ZTSMJUGI ). You are receiving this because you authored the thread. Message ID: <drizzle-team/drizzle-orm/issues/1424/1783739142 @ github. com>
Wanted to add to this, that I did try using postgres-js driver with supabase and I'm still experiencing the same issues as @samducker. Both :
import * as schema from './schema';
import { drizzle } from 'drizzle-orm/postgres-js';
import { Pool } from 'pg';
const connectionSring = process.env.DATABASE_URL as string;
const pool = new Pool({ connectionString: connectionSring });
export const db = drizzle(pool, { schema });
and
import * as schema from './schema';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const connectionSring = process.env.DATABASE_URL as string;
const client = postgres(connectionSring);
export const db = drizzle(client, { schema });
have the same issues with edge runtime and supabase.
Would likely need a whole new driver in order for this functionality to work. Personally considering switching to neon because I don't want to go back to prisma accelerate just for edge functions 😅
What version of
drizzle-orm
are you using?0.28.6
What version of
drizzle-kit
are you using?No response
Describe the Bug
I am trying to use drizzle over vercel edge and following the guides with cloudflare workers + supabase shown on the drizzle documentation (as vercel edge is just a cloudflare wrapper)
Doc: https://orm.drizzle.team/docs/quick-postgresql/supabase
This is my code
This is my error
normal (non edge) works fine I am using supabase connection pooler also
Expected behavior
No response
Environment & setup
No response