Minimal reproduction case for prisma/prisma#28620
When using Prisma 7 with dual schema setup (two different databases), TypeScript throws an error during npm run build:
Type error: This expression is not callable.
Each member of the union type '(<T extends AccountFindFirstArgs>(args?: SelectSubset<T, AccountFindFirstArgs<DefaultArgs>> | undefined) => Prisma__AccountClient<GetFindResult<$AccountPayload<DefaultArgs>, T, { ...; }> | null, null, DefaultArgs, { ...; }>) | (<T extends AccountFindFirstArgs>(args?: SelectSubset<...> | undefined) => Prisma__Account...' has signatures, but none of those signatures are compatible with each other.
This error occurs at the findFirst call in src/app/actions.ts:6:40.
This project demonstrates the issue with:
- Next.js 16.1.6 with TypeScript
- Prisma 7.4.0 with dual schema configuration
- Two Prisma schemas:
prisma-1/- MySQL schemaprisma-2/- SQLite schema
- Unified Prisma client in
src/lib/prisma.tsthat switches between clients based on environment
prisma-7-bug/
├── prisma-1/
│ ├── schema.prisma # MySQL schema
│ └── types/ # Generated MySQL client
├── prisma-2/
│ ├── schema.prisma # SQLite schema
│ └── types/ # Generated SQLite client
├── src/
│ ├── app/
│ │ ├── actions.ts # Server action with findFirst call (ERROR HERE)
│ │ └── page.tsx # Page that calls the action
│ └── lib/
│ └── prisma.ts # Unified client that imports both schemas
├── prisma.config.ts # Prisma config for dual setup
└── .env # Environment variables
-
Install dependencies:
npm install
-
Generate Prisma clients:
npx prisma generate --schema ./prisma-1/schema.prisma npx prisma generate --schema ./prisma-2/schema.prisma
-
Run build (reproduces the error):
npm run build
The build should complete successfully without TypeScript errors.
TypeScript compilation fails with the error:
./src/app/actions.ts:6:40
Type error: This expression is not callable.
The error occurs at prisma.account.findFirst({...}) in the server action.
This file creates a unified Prisma client by:
- Importing both
PrismaClientfrom the two generated schemas - Re-exporting types from
prisma-1 - Conditionally creating either client based on
USE_SQLITEenv var
Contains a minimal server action that calls prisma.account.findFirst(), which triggers the TypeScript error during build.
- Next.js: 16.1.6
- Prisma: 7.4.0
- TypeScript: 5.x
- OS: Linux (Fedora)
- The error only occurs during Next.js build, not during runtime
- The error is specific to TypeScript type checking
- Both schemas have identical
Accountmodel definitions - The issue appears to be related to type union incompatibility when combining two Prisma clients