PrismaClientInitializationError - Medal awarded for whoever that solves this.

Hello boys and girls, and a big thank you for reading this. I have a website created with react nextjs using prisma orm and cockroachDB as Db and hosted in Vercel. In my logs, I sometimes recieve this error below, but when I go to the page, the page works fine each time.
PrismaClientInitializationError: Invalid prisma.product.findMany() invocation: Can't reach database server at ****-**-****.7tc.aws-eu-central-1.cockroachlabs.cloud:26257 Please make sure your database server is running at ****-**-****.7tc.aws-eu-central-1.cockroachlabs.cloud:26257. at In.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:122:7154) at In.handleAndLogRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:122:6188) at In.request (/var/task/node_modules/@prisma/client/runtime/library.js:122:5896) at async l (/var/task/node_modules/@prisma/client/runtime/library.js:127:11167) at async getServerSideProps (/var/task/.next/server/pages/index.js:1:3911) { clientVersion: '5.12.1', errorCode: undefined }
or it can be att at:
async getServerSideProps (/var/task/.next/server/pages/product/[name].js:1:9042)
Different pages, but when i go in each time, the pages work fine. Has anyone stumbled upon this before or can guide me to the right direction to understanding and solving this issue? Thanks a lot for reading this ❤️
3 Replies
Knight Sigurd
Knight SigurdOP4mo ago
No one? 🥲 Anyone? 😆
Nurul
Nurul4mo ago
Hey 👋 Does this happen on all of your database queries or only on certain specific queries? Did you try upgrading prisma to the latest version?
Knight Sigurd
Knight SigurdOP4mo ago
Hello, thank you for the reply, It happens with the findFirst() and FindMany() method from what i've seen. The target is 95% of the times on the product table (prisma.product...) but has also targeted another table that is used when another process related to that table was initiated. The findMany and FindFirst is used to fetch the products from the database, render it on server side rendered page. However, today, I changed the parameter in the database_URL key in the environment file from sslmode=verify-full to sslaccept=strict and the errors seems to have disappeared, but not sure if that solves the actual problem... Not sure what the latest version is, I have 5.12.1. Is there something on the later versions that tackle this issue? 😮
Want results from more Discord servers?
Add your server