Turborepo with Prisma throwing Error
We are encountering an issue with our Next.js application using a Turborepo setup, integrated with Prisma ORM and Neon Postgres as the database. Upon invoking prisma.job.findFirst(), the following error is thrown:
⨯ PrismaClientKnownRequestError:
Invalid
prisma.job.findFirst()
invocation:
Error validating datasource db
: the URL must start with the protocol prisma://
at Ln.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:121:7753)
...
code: 'P6001',
clientVersion: '5.19.1',
meta: { modelName: 'Job' }
The error stems from Prisma's validation of the datasource URL, indicating that the connection URL should start with the prisma:// protocol. However, Prisma typically expects a URL format like postgresql:// or mysql:// depending on the database used, making this error unexpected.5 Replies
Hi @Priyank T Rajai 👋
If you're using Prisma Accelerate, you will need to replace your direct database url with your new Accelerate connection string which usually starts with
prisma://
Getting started with Prisma Accelerate | Prisma Documentation
Learn how to get up and running with Prisma Accelerate.
Hey @RaphaelEtim ,
We are not using Prisma Accelerate
Can you please share how you are instantiating Prisma Client?
Also are you using vercel-postgres?
You may be missing the
@prisma/adapter-neon
database adapter. Take a look at this section of the documentation.Deploy to Vercel Edge Functions & Middleware | Prisma Documentation
Learn the things you need to know in order to deploy an Edge function that uses Prisma Client for talking to a database.
Deploy to Vercel Edge Functions & Middleware | Prisma Documentation
Learn the things you need to know in order to deploy an Edge function that uses Prisma Client for talking to a database.