new PrismaClient() throws as soon as the app starts after moving to Prisma ORM 7
Your error
PrismaClientInitializationError: PrismaClient was instantiated without any options. A driver adapter is required to connect to your database.4 more lines it can showFix it fast
Most common cause, 1 of 3The client is created with no options
Install the adapter for your database and hand it to the constructor.
npm install @prisma/adapter-pg@7
// src/db.ts
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from '../generated/prisma/client'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
export const prisma = new PrismaClient({ adapter })Short answer
Prisma ORM 7 dropped the built-in connection: the client generated by the prisma-client provider talks to the database only through a driver adapter. new PrismaClient() with no options, or with the v6 datasourceUrl or datasources options, therefore fails at startup. Install the adapter for your database, for example @prisma/adapter-pg, and pass it as { adapter }.
Which cause do you have?
Confirm the installed version and find every place the client is created. The fix is the same for all of them.
npx prisma --version
grep -rn "new PrismaClient(" src app lib 2>/dev/nullThen find the line you see in this list and open its fix:
- 1The client is created with no options
On 7.10 the message says a driver adapter is required; on 7.0.0 the same code fails with a TypeError about __internal - 2The v6 connection options are still passed
Unknown property datasourceUrl (or datasources) provided to PrismaClient constructor - 3The project connects through Prisma Accelerate
DATABASE_URL starts with prisma:// or prisma+postgres://
What does the error look like?
PrismaClientInitializationError: PrismaClient was instantiated without any options. A driver adapter is required to connect to your database.PrismaClientConstructorValidationError: Using engine type "client" requires either "adapter" or "accelerateUrl" to be provided to PrismaClient constructor.TypeError: Cannot read properties of undefined (reading '__internal')PrismaClientConstructorValidationError: Unknown property datasourceUrl provided to PrismaClient constructor.error TS2554: Expected 1 arguments, but got 0.
Cause 1 of 3
The client is created with no options
You seeOn 7.10 the message says a driver adapter is required; on 7.0.0 the same code fails with a TypeError about __internal
Check
The upgrade guide states that creating a Prisma Client now requires a driver adapter for every database. Old code that called new PrismaClient() with nothing in the brackets has no way to reach the database any more, and TypeScript also flags the missing argument.
grep -rn "new PrismaClient()" .Fix
Install the adapter for your database and hand it to the constructor. PostgreSQL uses @prisma/adapter-pg, SQLite uses @prisma/adapter-better-sqlite3; the database drivers page lists the others.
npm install @prisma/adapter-pg@7
// src/db.ts
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from '../generated/prisma/client'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
export const prisma = new PrismaClient({ adapter })Verify
Start the app or run a script that imports the client; it constructs without throwing and the first query reaches the database.
// scripts/check-db.ts
import { prisma } from '../src/db'
prisma.$queryRaw`SELECT 1`.then(console.log).finally(() => prisma.$disconnect())
npx tsx scripts/check-db.tsConfirmed by prisma.io
Cause 2 of 3
The v6 connection options are still passed
You seeUnknown property datasourceUrl (or datasources) provided to PrismaClient constructor
Check
Version 6 let you override the URL with datasourceUrl or datasources.db.url. In 7 the constructor validates its options and rejects those keys, because the connection string now belongs to the adapter.
grep -rnE "datasourceUrl|datasources:" src app libFix
Delete those keys and give the same URL to the adapter instead. The CLI side (migrate, db push) reads the URL from prisma.config.ts, so keep it there too.
// before (v6)
// const prisma = new PrismaClient({ datasourceUrl: process.env.DATABASE_URL })
// after (v7)
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })Verify
TypeScript compiles the file and the constructor no longer reports an unknown property.
npx tsc --noEmitConfirmed by prisma.io
Cause 3 of 3
The project connects through Prisma Accelerate
You seeDATABASE_URL starts with prisma:// or prisma+postgres://
Check
An Accelerate URL is not a direct database connection, so it must not be given to PrismaPg. Version 7 expects it in its own constructor option.
node -e "console.log((process.env.DATABASE_URL||'').split(':')[0])"Fix
Pass the URL as accelerateUrl and keep the Accelerate extension, until you move to a direct connection with an adapter.
import { PrismaClient } from '../generated/prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'
export const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())Verify
The client starts and a simple findFirst returns through Accelerate.
prisma.user.findFirst().then(console.log)Confirmed by prisma.io
How do I stop it coming back?
- Create the client in one module and import it everywhere, so a constructor change touches one file.
- Upgrade prisma and @prisma/client together and to the same version.
- Run the app's startup in CI after a major Prisma upgrade; this error never shows at compile time in plain JavaScript.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.