New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this.$on("beforeExit")
doesn't work anymore on 5.0.0
#20171
Comments
Yes, this is a breaking change, see our release notes and upgrade guide:
https://github.com/prisma/prisma/releases/tag/5.0.0 We'll make sure that NestJS guide is updated now. |
this.$on("beforeExit")
doesn't work anymore on 5.0.0
I'll keep this issue open until we have actually updated that guide - this way it is easier for other people to find. Thanks for reporting so quickly by the way! |
@maxime4000 Final implementation would look something like this, https://docs.nestjs.com/fundamentals/lifecycle-events#application-shutdown |
Hi @maxime4000 and anyone else who faces the same issue! As already correctly pointed out above, you should use the normal shutdown hooks and lifecycle events in NestJS as you would in any other NestJS application not using Prisma. The Prisma guide in the NestJS documentation and our guides and examples are unfortunately a little bit outdated in this regard: this kind of special integration for shutdown hooks with Prisma hasn't been required for a while already since the introduction of the library engine, but it continued to work as we kept the To migrate to the standard NestJS shutdown hooks, you need to do the following steps:
|
I read it in the docs and that way it worked for me
|
Docs and examples have been updated on both NestJS and our side, I'll go ahead and close this issue. |
Bug description
Using prisma v5 and having a prismaService, the new code doesn't work anymore.
https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services
How to reproduce
https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services
Expected behavior
beforeExit should be a typing option ? now it's never
Prisma information
// Add your schema.prisma
// Add your code using Prisma Client
V5 latest no schema really required
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: