Next, prisma, postgres setup error

Hello, I would like to setup a next, prisma, postgres project. In production I have this error: ⨯ Error [PrismaClientInitializationError]: Invalid prisma.user.findUnique() invocation: Can't reach database server at vertical-sync-prod-ndyoam:5432 Please make sure your database server is running at vertical-sync-prod-ndyoam:5432. I have set up the environment variable with the internal connection url. By the way, I'd like to know how it works to add extensions like postgis, and how migrations, push db seed etc work?
5 Replies
Sang Dang
Sang Dang2mo ago
I guess you created independent app for nextjs, and postgres database etc? If yes I think we still have to expose the database to the internet (using external port then use the external databsae url) about helping you specifically with prisma, I think it's outside the scope of Dokploy's support team but in my case, I create a github actions that detect the changes inside prisma folder, if it has any change, usually the new migrations files, it will be triggered and use the external DATABASE_URL to run the migration script for seeding, usually I run from localhost, again using external database url too
ioTactile
ioTactileOP2mo ago
Hi, the database provided in the services didn't allow me to have my postgis and pg_trgm extensions, so I made a docker service with my custom postgres image. My question is how do I get the database url in next to be on the same network as the db?
Zamblar
Zamblar2mo ago
@Sang Dang , so there isn't a way to connect directly to my db using the internal url? @ioTactile , at the end how did you solve this?
Sang Dang
Sang Dang2mo ago
I do not have time to test, but at this point: - if I want to connect directly to my db using internal url like "postgres:5432", I usually use docker compose solution - if I use Dokploy's database service (e.g. create the databse using dokploy UI), I open external port like "55123" and use external url there is a thread on github issue about this, I think you can find how they resolve it, I forgot the details, sorry cant help much
Zamblar
Zamblar2mo ago
Ohh I saw that thread, but for me it was like: There should be a way to connect to my DB using the db internal url, without opening the external port Thanks @Sang Dang !

Did you find this page helpful?