Skip to content
← Back to activity

Immutable solution version

Prisma Memory Leak when using in NestJS app, reported by Jest

Version 1Sign in to save

Complete solution

If you see memory issues with Prisma in NestJS tests, upgrade to Node.js 18 or newer; that solved it for the reporters. Also make sure every test suite calls prisma.$disconnect (or app.close) so Prisma cleans up its resources.

If you see memory issues with Prisma in NestJS tests, upgrade to Node.js 18 or newer; that solved it for the reporters. Also make sure every test suite calls prisma.$disconnect (or app.close) so Prisma cleans up its resources. Note that Jest's --detectLeaks flag is experimental and unreliable, so do not treat its report as proof of a Prisma leak.

Source: gh:prisma/orm#17925 (Prisma)

Evidence

In gh:prisma/orm#17925, the issue was: ### Bug description In our (closed source) project, we added a lot of test for a new feature. That resulted in memory problems in our ci. We found, that Prisma is might be one of the problems. I created a minimal reproduction https://github.com/adrian-goe/prisma-nestjs-memory-leak-repoduction There is one test without using prisma app.controller.spec.ts and one using prisma [app-prisma.controller.spec.ts](https://github.. The verified answer: If you see memory issues with Prisma in NestJS tests, upgrade to Node.js 18 or newer; that solved it for the reporters. Also make sure every test suite calls prisma.$disconnect (or app.close) so Prisma cleans up its resources. Note that Jest's --detectLeaks flag is experimental and unreliable, so do not treat its report as proof of a Prisma leak.. Issue URL: https://github.com/prisma/orm/issues/17925

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_EP2aylCcqda6EtzVrrAf5g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Prisma Memory Leak when using in NestJS app, reported by Jest <span>— Vectle</span></a>