zenstackhq / zenstack

Fullstack TypeScript toolkit enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
1.83k stars 78 forks source link

[Bug] zenstack generate fails with prisma@5.16.0 #1535

Open AmruthPillai opened 5 days ago

AmruthPillai commented 5 days ago

Description and expected behavior

Prisma just released a new version 5.16.0, and this probably came with some changes to their internal types that Zenstack relied upon. When running zenstack with prisma@5.16.0, I run into this bug:

> zenstack generate

⌛️ ZenStack CLI v2.2.4, running plugins
✔ Generating Prisma schema
✔ Generating PrismaClient enhancer
Error compiling generated code:
node_modules/.pnpm/@zenstackhq+runtime@2.2.4_@prisma+client@5.16.0_prisma@5.16.0_/node_modules/.zenstack/enhance.ts:33:13 - error TS2314: Generic type 'DynamicClientExtensionThis' requires 4 type argument(s).

33     prisma: DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs>,
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@zenstackhq+runtime@2.2.4_@prisma+client@5.16.0_prisma@5.16.0_/node_modules/.zenstack/enhance.ts:34:77 - error TS2314: Generic type 'DynamicClientExtensionThis' requires 4 type argument(s).

34     context?: EnhancementContext<auth.User>, options?: EnhancementOptions): DynamicClientExtensionThis<Prisma.TypeMap, Prisma.TypeMapCb, ExtArgs>;
                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

: Error compiling generated code
 ELIFECYCLE  Command failed with exit code 1.

Right now, the solution is just to stick to the previous version of Prisma (v5.15.1) which is completely fine. Just wanted to let the devs of this amazing library in-the-know that it's would break for anyone trying to spin up a new project with latest versions.

Environment (please complete the following information):

ymc9 commented 3 days ago

Thanks for filing this @AmruthPillai . I created a dup #1536 here. It'll be fixed in the upcoming 2.3.0 release!