Closed sidneip closed 1 year ago
Hi @sidneip are you generating the Prisma Client to a custom location?
PrismaClientExceptionFilter
relies on @prisma/client
to specify the exceptions to handle.
No, i did setup default.
Did you run npx prisma generate
? Maybe the prisma client hasn't been generated.
Nevermind, I tried it out again and also got the same error as you experiencing.
If you want to use APP_FILTER
you need to us a factory instead of the class
providers: [
AppService,
{
provide: APP_FILTER,
useFactory: ({ httpAdapter }: HttpAdapterHost) => {
return new PrismaClientExceptionFilter(httpAdapter);
},
inject: [HttpAdapterHost],
},
],
Alternative would be to instantiate PrismaClientExceptionFilter
in main.ts
. I will update the docs. Thanks for reporting the bug.
I updated the docs for applying APP_FILTER
correctly 👉 https://nestjs-prisma.dev/docs/exception-filter/#app_filter
Thanks @marcjulian
I did one test and i have success.
i am getting error when i am configure PrismaClientExceptionFilter in app.module.ts
[Nest] 32200 - 01/02/2023, 11:14:18 LOG [NestFactory] Starting Nest application... [Nest] 32200 - 01/02/2023, 11:14:18 LOG [InstanceLoader] PrismaModule dependencies initialized +76ms [Nest] 32200 - 01/02/2023, 11:14:18 ERROR [ExceptionHandler] Nest can't resolve dependencies of the PrismaClientExceptionFilter (?, Object). Please make sure that the argument Object at index [0] is available in the AppModule context.
Potential solutions:
Error: Nest can't resolve dependencies of the PrismaClientExceptionFilter (?, Object). Please make sure that the argument Object at index [0] is available in the AppModule context.
Potential solutions: