prisma accelerate can I connect to my database?
My database was made locally. The database functioned as intended when I tried it without acceleration. but acceleration is necessary for my authentication.
I am using
auth.js V5
The latest version of prisma accelerate
next.js
![No description](https://cdn.answeroverflow.com/1244899015183695882/Screenshot_2024-05-27_at_10.59.21_PM.png)
![No description](https://cdn.answeroverflow.com/1244899015796199465/Screenshot_2024-05-27_at_11.02.29_PM.png)
![No description](https://cdn.answeroverflow.com/1244899016127418378/Screenshot_2024-05-27_at_11.19.05_PM.png)
![No description](https://cdn.answeroverflow.com/1244899016433598495/5.png)
7 Replies
![No description](https://cdn.answeroverflow.com/1244901910247641109/6.png)
Hey @gave_one 👋
Your database needs to be hosted somewhere in the cloud, so that Prisma Accelerate can connect to it. If your database is running locally via localhost then it won't be accessible. So, Prisma Accelerate would not work with a local database.
@Nurul (Prisma) this article https://www.prisma.io/docs/accelerate/local-development#:~:text=The%20following%20steps%20outline%20how%20to%20use%20Prisma,DATABASE_URL%3D%22postgres%3A%2F%2Fusername%3Apassword%40127.0.0.1%3A5432%2Flocaldb%22%20Generate%20a%20Prisma%20Client%3A%20npx%20prisma%20generate says it works with a local database. However I am running into errors when following along with this documentation. Is it safe to say this documentation is out of date and we can assume it won't work with a local database?
Accelerate: Local development | Prisma Documentation
Learn how to use Prisma Accelerate in a development environment.
Hey @Colin Nick
What error are you getting?
"PrismaClientValidationError: Invalid client engine type, please use
library
or binary
"
This is when I use the "prisma/client/edge" Prisma client with a local database & using npx prisma generate (instead of using --no-engine)
I can get it to work with if I use "prisma/client" Prisma Client instead though but then I receive issues with my next middleware.ts file requiring prisma to be an edge callOkay, I was able to get it to work since it was authjs that was forcing my database call. I followed https://authjs.dev/guides/edge-compatibility and now I can use my auth client in my middleware.
Auth.js | Edge Compatibility
Authentication for the Web
This however still doesn't solve for the core of the issue which would be using accelerate with a local db