P
Prisma2mo ago
gave_one

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
No description
No description
No description
7 Replies
gave_one
gave_one2mo ago
No description
Nurul
Nurul2mo ago
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.
Colin Nick
Colin Nick2mo ago
@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.
Nurul
Nurul2mo ago
Hey @Colin Nick What error are you getting?
Colin Nick
Colin Nick2mo ago
"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 call
Colin Nick
Colin Nick2mo ago
Okay, 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
Colin Nick
Colin Nick2mo ago
This however still doesn't solve for the core of the issue which would be using accelerate with a local db