PrismaClientInitializationError:
Answered
Dwarf Crocodile posted this in #help-forum
Dwarf CrocodileOP
I'm still trying to deploy my application and I am now getting a "PrismaClientInitializationError". It's saying An error occured "prerendering page". I'm not familiar with what is causing that.
There is my "getall" route
And I posted a picture of my reducers in case that was needed to help diagnose what is going on. Thank you again for helping me.
There is my "getall" route
And I posted a picture of my reducers in case that was needed to help diagnose what is going on. Thank you again for helping me.
Answered by joulev
the cause is that you are trying to access a local database at localhost:5432, but it is only accessible on your computer and not on vercel
34 Replies
@Dwarf Crocodile I'm still trying to deploy my application and I am now getting a "PrismaClientInitializationError". It's saying An error occured "prerendering page". I'm not familiar with what is causing that.
There is my "getall" route
And I posted a picture of my reducers in case that was needed to help diagnose what is going on. Thank you again for helping me.
the cause is that you are trying to access a local database at localhost:5432, but it is only accessible on your computer and not on vercel
Answer
add the prod db connection string, not the local db connection string, as the DATABASE_URL (or a similarly named) environment variable
Dwarf CrocodileOP
Oooooh that makes a lot of sense
what is the value of DATABASE_URL in vercel? give me a truncated version of it (so i know its structure, but you don't leak any secrets)
Dwarf CrocodileOP
nextjsapp-**-**.vercel.app
no not that one
Dwarf CrocodileOP
Okay there were a lot more *** but Discord shortened it
Oh. Which one?
remove the secret parts
does it include "localhost:5432"?
or "127.0.0.1:5432" or "anything:5432"
Dwarf CrocodileOP
Oooooh. No nothing in Vercel does. Hang on
DATABASE_URL="postgresql://postgres:***@localhost:5432/**?schema=public"
Sorry. That was probably what you wanted
@Dwarf Crocodile DATABASE_URL="postgresql://postgres:***********@localhost:5432/**********?schema=public"
yes exactly. so the problem is that you are trying to access a database at localhost:5432, but you only have that db in your computer not on vercel
vercel doesn't have anything running on localhost:5432 (their localhost, not yours)
you have to make a cloud database in your private server if you have one, or use a service like neon, vercel postgres or planetscale etc, then get the connection string of it
which shouldn't look like the localhost:5432 but should have the domain/ip of the database host
then use it as the DATABASE_URL value
Dwarf CrocodileOP
Do you recommend a specific one by chance?
If not I will find one
I've used MongoDB a couple of times, which I can do. But I'd have to change around some things.
Well one thing I know of
@joulev then use it as the DATABASE_URL value
for example i use planetscale so my connection string looks like this: mysql://xxx:xxx@us-east.connect.psdb.cloud/xxx?sslaccept=strict
i connect to
us-east.connect.psdb.cloud domain which is accessible from vercel, not localhost:* which is not accessible from vercel@Dwarf Crocodile Do you recommend a specific one by chance?
if you are using postgres then i can recommend vercel postgres or neon
Dwarf CrocodileOP
Okay. I will go with vercel postgres
Thank you. I really appreciate it
good luck and have fun
@joulev good luck and have fun
Dwarf CrocodileOP
Thank you