Giter Site home page Giter Site logo

Error: "beforeExit" hook is not applicable to the library engine since Prisma 5.0.0, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead. about nestjs-prisma HOT 8 CLOSED

notiz-dev avatar notiz-dev commented on June 17, 2024 5
Error: "beforeExit" hook is not applicable to the library engine since Prisma 5.0.0, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.

from nestjs-prisma.

Comments (8)

marcjulian avatar marcjulian commented on June 17, 2024 2

await prismaService.enableShutdownHooks(app); is not needed any more, since Prisma v3. Read the comments and docs update for nestjs Prisma receipe

I will remove it and provide a new version with support for Prisma v5.

from nestjs-prisma.

yangricardo avatar yangricardo commented on June 17, 2024 1

I commented the enableShutdownHooks code block and worked to make this work, but not sure if prisma 5.0.0 still needs it with Nestjs.

from nestjs-prisma.

yangricardo avatar yangricardo commented on June 17, 2024 1

@sangdth . I noticed something similar when you have some turborepo internal package or app that have in it's package.json a diferent version of some package, in your case @prisma/client, verify in your project for conflicted dependency versions and try to keep them in the same version manually or creating a "config" package that you refers alongside your packages.
If it not works, clean the generated dist, build, node_modules and lock files from package manager

In my case I use turborepo, and I moved the prisma out into separated package, after upgrading for some reason I don't know, it still tries to find the old version. I'm not sure it's because of turborepo cache or because nestjs-prisma forces it to use older version.

Error: Cannot find module '.prisma/client/index'
Require stack:
- /app/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/index.js
- /app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-prisma/dist/prisma.service.js
- /app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-prisma/dist/prisma.module.js
- /app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-prisma/dist/index.js
- /app/apps/server/dist/main.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/app/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/index.js:2:6)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19) {
code: 'MODULE_NOT_FOUND',

from nestjs-prisma.

yangricardo avatar yangricardo commented on June 17, 2024

https://www.prisma.io/docs/guides/upgrade-guides/upgrading-versions/upgrading-to-prisma-5#removal-of-the-beforeexit-hook-from-the-library-engine

Today i tried to use this with new Prisma 5.0.0 and i noticed this error:

Error: "beforeExit" hook is not applicable to the library engine since Prisma 5.0.0, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.
    at _t.on (/home/user/api/node_modules/@prisma/client/runtime/library.js:103:1990)
    at Proxy.$on (/home/user/api/node_modules/@prisma/client/runtime/library.js:126:5397)
    at Proxy.enableShutdownHooks (/home/user/api/node_modules/nestjs-prisma/lib/prisma.service.ts:42:10)
    at bootstrap (/home/user/api/src/main.ts:13:23)
which points to `main::bootstrap` function:
  // enable shutdown hook
  const prismaService: PrismaService = app.get(PrismaService);
  await prismaService.enableShutdownHooks(app);

from nestjs-prisma.

sangdth avatar sangdth commented on June 17, 2024

We faced problem when upgrading to version 5 too. Hope that we could have a new release soon. 🙏🏻

from nestjs-prisma.

recursive-beast avatar recursive-beast commented on June 17, 2024

Same problem, should update peer deps as well.

from nestjs-prisma.

sangdth avatar sangdth commented on June 17, 2024

In my case I use turborepo, and I moved the prisma out into separated package, after upgrading for some reason I don't know, it still tries to find the old version. I'm not sure it's because of turborepo cache or because nestjs-prisma forces it to use older version.

Error: Cannot find module '.prisma/client/index'
Require stack:
- /app/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/index.js
- /app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-prisma/dist/prisma.service.js
- /app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-prisma/dist/prisma.module.js
- /app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-prisma/dist/index.js
- /app/apps/server/dist/main.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/app/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/index.js:2:6)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19) {
code: 'MODULE_NOT_FOUND',

from nestjs-prisma.

marcjulian avatar marcjulian commented on June 17, 2024

Please try out the latest dev release 0.22.0-dev.0

from nestjs-prisma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.