I am trying to use Prisma 7.2 with NestJS in a Node 22 project running inside Docker, but I am running into errors when intsantiating the PrismaClient. My current PrismaService looks like this:
import { Injectable, OnModuleInit, OnModuleDestroy } from ‘@nestjsnestjs/common’;
import { PrismaClient } @prismarom ‘@prism@Injectable/client’;
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
constructor() {
super();
}
async onModuleInit() {
await this.$connect();
}
async onModuleDestroy() {
await this.$disconnect();
}
}
When I try to run the NestJS application, I get the following error:
PrismaClientInitializationError: `PrismaClient` needs to be constructed with a non-empty, valid `PrismaClientOptions`:
new PrismaClient({
…
})
or
constructor() {
super({ … });
}
-–
What I have already tried:
1. Passing adapter in super(), as in older documentation:
super({ adapter: ‘postgresql’ });
The error that occurred:
Type ‘string’ is not assignable to type ‘SqlDriverAdapterFactory’
2. Trying to import P@prismastgresqlAdapter from prisma/client/runtime:
import @prisma PostgresqlAdapter } from ‘prisma/client/runtime’;
super({ adapter: PostgresqlAdapter() });
The error that occurred:
Cannot find module ‘@prisma/client/runtime’ or its corresponding type declarations
3. Calling just super() without parameters → triggers the PrismaClientInitializationError shown above.
Environment details:
Prisma version: 7.2.0
Node: 22
NestJS: latest version
Database: Postgres running in Docker (docker-compose)
I am using the new “client” engine type of Prisma 7, so I cannot use url in the schema.prisma.