nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
68.19k stars 7.67k forks source link

JavaScript heap out of memory When upgrade `@nestjs/core ` from `^8.0.6` to `^10.0.5 ` #11996

Closed Usama-Tahir closed 1 year ago

Usama-Tahir commented 1 year ago

Is there an existing issue for this?

Current behavior

Hey all, I am in the middle of upgrading my Nestjs Graphql API to ^10.0.5 and I am running into JavaScript heap out of memory issues. The server doesn't start at all and crashes after 15-30 seconds. I am using prisma and I think this JavaScript heap out of memory issue might be originating from that. The app works fine on @nestjs/core: ^8.0.6 and @prisma/client": "^4.13.0" but I am getting issues on the following packages.

@prisma/client: "^4.16.2",
@nestjs/core: "^10.0.5"

Minimum reproduction code

Sorry I don't have a codesandbox that reprocues this bug. Please see the Other tab.

Steps to reproduce

I think this issue is very specific to my app that is using Prisma as an ORM.

Upgrade the @nestjs/core and @prisma/client to the following versions and this error may pop up in applications that are using Prisma.

@prisma/client: "^4.16.2",
@nestjs/core: "^10.0.5"

Expected behavior

The application should not throw JavaScript heap out of memory after upgrading to @nestjs/core: "^10.0.5" version

Package

Other package

@prisma/client

NestJS version

^10.0.5

Packages versions

"@nestjs/apollo": "^12.0.7",
"@nestjs/axios": "^3.0.0",
"@nestjs/cache-manager": "^2.0.1",
"@nestjs/common": "^10.0.5",
"@nestjs/config": "^3.0.0",
"@nestjs/core": "^10.0.5",
"@nestjs/graphql": "^12.0.7",
"@nestjs/jwt": "^10.1.0",
"@nestjs/passport": "^10.0.0",
 "@prisma/client": "^4.16.2",

Node.js version

v18.14.0

In which operating systems have you tested?

Other

I will see if I am able to create a sandbox with the repro steps but I am afraid it won't be easy to reproduce.

Tony133 commented 1 year ago

Hi @Usama-Tahir, Have you tried upgrading nestjs from version 8.0.0 to version 9.0.0 and then later to version 10.0.0 ? let's say a step by step update, try to do the same procedure also with prisma.

kamilmysliwiec commented 1 year ago

We can't help you without seeing a minimum reproduction repository.

As @Tony133 suggested above, we'd recommend you to first upgrade to v9 and then later on to v10, after addressing all breaking changes between major releases. Also, make sure that the version of @nestjs/core always matches versions of the following packages: @nestjs/common, @nestjs/websockets, @nestjs/microservices and all @nestjs/platform-....

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.