-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
I recently upgraded to Prisma 7.0.1 and have been unable to run my NestJS backend because PrismaClient crashes on initialization with the error:
TypeError: Cannot read properties of undefined (reading '__internal')This happens even after following the Prisma 7 migration guide, removing url from datasource, removing custom client output, deleting generated folders, reinstalling node_modules, and regenerating the client.
The error always points to:
node_modules/@prisma/client/src/runtime/getPrismaClient.ts:239:27Full Error
TypeError: Cannot read properties of undefined (reading '__internal')
at new t (node_modules/@prisma/client/src/runtime/getPrismaClient.ts:239:27)
at new PrismaService (src/prisma/prisma.service.ts:7:5)
at Injector.instantiateClass (...)Environment
• macOS: Apple Silicon (M1 pro) my mac
• Node: v22.17.0
• Package manager: pnpm
• Prisma: 7.0.1
• NestJS: 11
• Database: Postgres
What I Have Already Tried (important)
1. Removed all custom generator output (generated/prisma)
2. Ensured Prisma client imports are from @prisma/client only
3. Deleted folders:
rm -rf node_modules dist generated/prisma4. Reinstalled fresh:
pnpm install5. Regenerated client:
npx prisma generate6. Verified output:
✔ Generated Prisma Client (v7.0.1) to node_modules/@prisma/client7. Set engine type (both tried):
PRISMA_CLIENT_ENGINE_TYPE=node-api
PRISMA_CLIENT_ENGINE_TYPE=library8. Verified minimal PrismaService:
export class PrismaService extends PrismaClient {
constructor() { super(); }
}9. Completely removed datasource URL from schema (Prisma 7 requirement)
Despite all of this, the error persists.
Current Schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
model User {
id Int @id @default(autoincrement())
email String @unique
hash String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}Expected Behavior
PrismaClient should initialize normally as described in Prisma 7 migration examples.
Actual Behavior
PrismaClient throws a runtime crash:
Cannot read properties of undefined (reading '__internal')Even after a clean install, fresh generate, and removing all old client output.
My Request
Please investigate whether:
• getPrismaClient.ts is failing to load the correct runtime engine
• PrismaClient initialization is broken on Apple Silicon + Node-API
• There’s an undocumented breaking change in Prisma 7 affecting NestJS providers
• Or if the engine loader is failing silently during initialization