Prisma Singleton issue
I have a type issue I cant figure out why is happening .. im using the latest prisma v7..
Path: prisma/schema.prisma
schema.prisma:
generator client {
provider = "prisma-client"
output = "./generated/prisma"
}
Path: prisma.config.ts (project root level)
import 'dotenv/config'
import type { PrismaConfig } from "prisma";
import { env } from "prisma/config";
export default {
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
seed: 'tsx prisma/seed-apps.ts',
},
datasource: {
url: env("DIRECT_URL"), //DATABASE_URL: pooled , DIRECT_URL: direct Connection to the DB for Migrations
}
} satisfies PrismaConfig;
Now the issue I have is this : Expected 1 arguments, but got 0.ts(2554)
class.ts(73, 5): An argument for 'options' was not provided.
⚠ Error (TS2554) |
Expected 1 arguments, but got 0.
on this file : // lib/prisma.ts:
import { PrismaClient } from "@/prisma/generated/prisma/client"
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
export const prisma = globalForPrisma.prisma || new PrismaClient()
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
here is the prisma folder tree:
├─ prisma
│ ├─ generated
│ │ └─ prisma
│ │ ├─ browser.ts
│ │ ├─ client.ts
│ │ ├─ commonInputTypes.ts
│ │ ├─ enums.ts
│ │ ├─ internal
│ │ │ ├─ class.ts
│ │ │ ├─ prismaNamespace.ts
│ │ │ └─ prismaNamespaceBrowser.ts
│ │ ├─ models
│ │ └─ models.ts
│ ├─ migrations
│ │ ├─ 20251120140006_added_analytics_for_projects
│ │ │ └─ migration.sql
│ │ └─ migration_lock.toml
│ ├─ schema.prisma
│ └─ seed-apps.ts
├─ prisma.config.ts
8 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
The error comes from a change in the generated
PrismaClient constructor types in recent Prisma versions: the generated PrismaClient now has a generic constructor signature that expects an options argument, so new PrismaClient() without arguments no longer type-checks unless defaults are provided. This was reported when extending PrismaClient and required passing generics or changing the generated constructor signature. [Prisma 6.14 extend]
You’re using the new prisma-client generator with a custom output and importing from that path, which is correct:
and:
That matches the docs for the new generator. [prisma-client getting started]
The problem is specifically new PrismaClient() in your singleton:
Because of the updated constructor typing, TypeScript expects an options argument.
Workarounds visible in the knowledge:
1. Pass an options object (even empty, but typically with your config):
This satisfies the constructor signature. If you’re using Prisma.PrismaClientOptions, make sure log and other fields are correctly typed, e.g.:
(Using a properly typed options object is how a similar type error around log was fixed. [Multiple clients options])
2. If you extend PrismaClient or hit constructor generics you might need to specify the generic parameters explicitly, as in the reported workaround: [Prisma 6.14 extend]
But for a plain singleton like yours, simply passing an options object is enough; you don’t need to touch generics.
Your updated lib/prisma.ts would be:
If this still errors, the remaining typing details (constructor generics) aren’t fully documented in the provided sources; in that case, I’m afraid the knowledge we have doesn’t show an official v7-specific pattern beyond the general workarounds above.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.the version im using is Prisma v7 on a nextjs 15.5.0 version
Hey @Donda!
You need to pass adapter to prisma client which doesn't seem to be doing.
How to use Prisma ORM and Prisma Postgres with Next.js 15 and Verce...
Learn how to use Prisma ORM in a Next.js app and deploy it to Vercel
thanks i was able to fix this issue.
hye guys i just upgraded to prisma 7 folllow its documentation, using mysql im stuck at connection pooling time,
my db password has special character, and already strigify, what im missing here
@Reen Reen have you fixed it ?
still cannot