notiz-dev / nestjs-prisma

Easy Prisma support for your NestJS application
https://nestjs-prisma.dev
MIT License
587 stars 50 forks source link

Prisma@3 regression in PrismaClientExceptionFilter #54

Closed maxk096 closed 1 year ago

maxk096 commented 1 year ago

Hi, starting from 0.19.0, I found that support for prisma@3 was broken when using PrismaClientExceptionFilter.

0.19.0 introduced a new error type. But in prisma@3 there is no such error type. Thus, @Catch(...) is invoked with an undefined parameter. This leads to an app crash from Nestjs, because it doesn't anticipate an undefined parameter.

Here's a minimum reproduction code(based on a basic example from this repo, but using prisma@3). Simply call GET http://localhost:3000, and the app will crash, instead of responding with an error.

https://github.com/maxk096/nestjs-prisma-broken-v3

marcjulian commented 1 year ago

Hi thanks for reporting. I haven't tested it with Prisma@3 for a while.

The new exception NotFoundError is deprecated and replaced with PrismaClientKnownRequestError (https://github.com/notiz-dev/nestjs-prisma/commit/3abd538b655c2e6a40efcca413dcb35fe3dd58f8).

You can try the latest dev release to see if it still works with prisma@3.

npm install nestjs-prisma@0.21.0-dev.1
maxk096 commented 1 year ago

Tested the fix with v3 & v4 - it works, thanks.

marcjulian commented 1 year ago

This has been released with 0.21.0