Edge Runtime + Supabase + Drizzle: Possible?

Hello all- I am attempting to move my DB from planetscale to supabase, but after swapping to postgres clients, I started getting errors from Vercel during build: "The Edge Function "404" is referencing unsupported modules". The modules in question have been postgres when using postgres.js and then pg-connection-string, pg, pgpass, and split2 for node-postgres. I assumed this meant that these clients are not compatible with the edge runtime, so I looked at how others were connecting in environments like CF Workers, and it seemed like the recommendation was to use the "@supabase/supabase-js" supabase SDK instead. However I'm not sure if its possible to wrap drizzle around this client, rather than one of the plain postgres ones. Anybody figure out how to get drizzle working with supabase from an edge serverless function? I know Neon has a serverless client but I'm trying to make use of supabase's auth tools. Here is my repo: https://github.com/cxreiff/figrid/tree/5aaee1a69dc3a7eaa357c1e73ddc5e63a07589be
GitHub
GitHub - cxreiff/figrid at 5aaee1a69dc3a7eaa357c1e73ddc5e63a07589be
Text adventure service built with Remix. Contribute to cxreiff/figrid development by creating an account on GitHub.
2 Replies
cxreiff
cxreiff10mo ago
Should also note I'm using Remix, and the project type is correctly set in Vercel (saw someone solve a similar problem by changing this setting).
manishrc
manishrc9mo ago
@cxreiff Have you found a solution? I have the same problem with the PG drivers being incompatible with the Edge runtime. It seems that the drivers are now compatible with the Node compatibility on Cloudflare Workers. However, I believe Next.js explicitly restricts the usage to only the Edge runtime without Node compatibility.
Want results from more Discord servers?
Add your server