Drizzle + Sveltekit + Cloudflare + Supabase cannot get to work.
If I use Drizzle's docs, like :
I get node module resolution errors like:
If I follow Supabase's docs on connecting with drizzle, like:
I get node module errors like:
Cloudflare definitely says to use the newer colon-delimited name like
node:stream
, and I have followed all of Cloudflare's instructions for node compatibility, but these errors persist.
Anyone have advice?5 Replies
Add the option node_compat = true to wrangler.toml.
Did you try postgres-js instead of node-postgres for the drizzle import? Worked for me
I tried adding in
node_compat=true
flag in the dashboard (I dont have a wrnagler file with Sveltekit)
I'm not sure if I tried postgres-js (OP was too long ago to remember) I gave up and just started using Supabase's sdk which is certianly enough of an ORM, I was looking to keep the ORM flavor with drizzle. I will try this just for funsies thoughhaving the same problem - tried with both postgres-js and pg library
Same problem solved this by using @vercel/postgres
https://supabase.com/docs/guides/database/connecting-to-postgres/serverless-drivers
Serverless Drivers | Supabase Docs
Connecting to your Postgres database in serverless environments.