Next.js Discord

Discord Forum

Using vercel with supabase

Unanswered
Blanc de Hotot posted this in #help-forum
Open in Discord
Blanc de HototOP
I was working on my project and took a break from it but I was using Prisma ORM v6. However i came back and prisma v7 was out. I tried connecting a new db to my project but was having a hared time to even populate my seed. im still on v6 haven't upgraded yet. However I was having this problem where Vercel gave me a bunch of links for supabase and i tried using this link as my db url: POSTGRES_URL_NON_POOLING="***@***..:5432" however no matter what I tried I kept getting errors that I could not fix no matter what I tried. for example one of those errors said something along the lines of
The table public.FuelType does not exist in the current database.code: 'P2021'
and prepared statement "s0" already exists
I tried the other urls and nothing worked. that was until i went to the supabase website and got a url from there which used a different port: postgresql://postgres:[YOUR_PASSWORD]@*************.supabase.co:5432/postgres
I tried this and it worked for some reason.
Now that I populated my db i can use the other url from vercel for my supabase db. But I would like to know why it did not work with the other but did with the url from supabase.
my nextjs app was working just fine about a month ago.
thank you for any info. Thanks in advanced.
(sorry if this isn't the right place to ask this, I'm not sure)
(update: the link i got from vercel directly that has the key POSTGRES_URL_NON_POOLING= does not work at all. i cannot make requests to the db. But if I use the other link it does works)

3 Replies

1) I am not an expert in this,
2) but I can tell that POSTGRES_URL_NON_POOLING indicates private database, probably hosted locally on your vercel.
3) The table public.FuelType does not exist in the current database.code: 'P2021' - means that you probably have not ran npx prisma migrate or npx prisma db push on a deployed database ( https://supabase.com/partners/integrations/prisma )
4) and that makes sense since you might of forgot how it was set up ?
5) prepared statement "s0" already exists (https://stackoverflow.com/questions/71026259/prisma-postres-error-prepared-statement-s0-already-exists)


After reading second reply to 5), and reading your update about non working link, I think that you have have hosted ( or least tried to ) Supabase on vercel (https://vercel.com/marketplace/supabase)

But now, you are using Supabase Official dashboard (https://supabase.com/) and host db there.

In conclusion, Main problem was probably connected with incorrect Supabase set up on your vercel, and was resolved because you switched from Vercel to Supabase dashboard
Blanc de HototOP
Thank you for replying, and I have now looked at some of the other urls and confirmed that there is one url that works from the vercel website
its the following
POSTGRES_PRISMA_URL="postgres://postgres.gugzsgubdqhkvnkhooos:[psswd]@aws-1-us-east-1.pooler.supabase.com:6543/postgres?sslmode=require&pgbouncer=true"
but these two do not work
POSTGRES_URL="postgres://postgres.gugzsgubdqhkvnkhooos:[psswd]@aws-1-us-east-1.pooler.supabase.com:6543/postgres?sslmode=require&supa=base-pooler.x"
POSTGRES_URL_NON_POOLING="postgres://postgres.gugzsgubdqhkvnkhooos:[psswd]@aws-1-us-east-1.pooler.supabase.com:5432/postgres?sslmode=require"
and right I could not use npx prisma migrate or npx prisma db push or even npx prisma generate when I used the last two urls. However, once I changed the url that I got from the supabase website I was able to genreate and migrate my db and my website started communicating with my db. I also tried the first url with the key POSTGRESS_PRISMA_URL and this one also allows me to communicate with the db. For some reason it doesn't like those last 2 urls.