admin管理员组

文章数量:1279177

Is it possible to disable the database URL accessibility check when initializing the Prisma client?

I'm building a Next.js app locally, and the database is hosted at mysql.hostinger:3306, but it is not accessible remotely.

As a result, during the build process, Prisma throws the following error:

PrismaClientInitializationError:
Can't reach database server at mysql.hostinger:3306

I can't run the build on the hosting server because my hosting plan doesn't allow it.

Is it possible to disable the database URL accessibility check when initializing the Prisma client?

I'm building a Next.js app locally, and the database is hosted at mysql.hostinger:3306, but it is not accessible remotely.

As a result, during the build process, Prisma throws the following error:

PrismaClientInitializationError:
Can't reach database server at mysql.hostinger:3306

I can't run the build on the hosting server because my hosting plan doesn't allow it.

Share Improve this question asked Feb 25 at 8:22 Eli TrefEli Tref 1421 silver badge9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You have a local database that you use for development, right? Surely you're not coding blindly without a database, building for production and testing there?

What you should be doing is using environment variables: in your local environment, the database URL should point to your own computer; in production it would point to the hosted DB.

Here's NextJs documentation on environment variables. And this is how to configure Prisma.

本文标签: