Closed kylemclaren closed 5 months ago
Hi Kyle, would love to be able to support this. Will size up the effort and report back. So glad you're into the app!
Ok, did some digging/prototyping and it seems like there aren't reliable drop-in pg
replacements that work on Vercel's edge runtime, which is used heavily throughout the template. Even Supabase's recommended approach of appending ?workaround=supabase-pooler.vercel
to the POSTGRES_URL
connection string crashed/hanged for me when deployed (confusingly, it seems to work locally).
One potential solution could be to switch all functions to nodejs
in the presence of a Supabase-preferred configuration, but I'd want users to be aware of the trade-off they're implicitly making.
Will keep thinking on this.
Thanks for looking at this, Sam! I tried that same workaround — it also crashed. I think it's related to the @neondb/serverless driver:
NeonDbError: Server error (HTTP status 404): Not Found
More than that I don't yet know — but I'll keep exploring this and post back here if I get any further.
After some final testing, it doesn't feel viable to move this app off the edge runtime to support a different database.
Closing this for now, though there's a good chance—with the right optimizations—that this template will eventually migrate to Node.js. Should that happen, will definitely revisit this issue!
Now that the app uses the Node.js runtime, this was fairly straightforward to implement in #86
@kylemclaren let me know if this works for your use case
@sambecker Awesome! Will try this out asap
Merged!
Awesome @sambecker I tried to test this branch but hit some weird issue where my ENV vars are not being read — possibly related to moving away from the edge runtime. I am investigating elsewhere, but appreciate the work that went into this PR!
Can you post some of your issues/errors @kylemclaren?
I have a project currently connecting to Supabase in prod and it seems to work fine. What specifically are you seeing?
Well, my env vars are definitely set and present on the VM, but I still see:
I didn't want to raise it here as I am running this app on Fly.io and not Vercel — so it was something I wanted to figure out on the Fly side first. Will test on Vercel next.
Ok—good to know!
If no configuration's showing up, sounds like this isn't an issue specific to Postgres/Supabase?
Correct! I'll close this out.
Quick update here @sambecker — tested with Supabase (after figuring out my ENV issues) and looks to be working just fine.
Amazing! Thanks for confirming.
Hi, love this app!
I am deploying it on not Vercel, so I'd like to be able to use Supabase instead of Vercel Postgres. My understanding is this is supported in the SDK: https://vercel.com/docs/storage/vercel-postgres/sdk#createclient
Kicking this off in case others have a workaround to offer, but ultimately it would be nice to have the option to set a
DATABASE_URL
for any other PG and it Just Works™️When I try to set
POSTGRES_URL
andPOSTGRES_URL_NON_POOLING
to my Supabase instance, I get:Also, see https://github.com/orgs/supabase/discussions/14165 and https://github.com/vercel/storage/issues/123