Ben
PPrisma
•Created by Ben on 4/16/2025 in #help-and-questions
'Too many clients' error when using NestJS and Jest even with a singleton Service
If somebody else ever looks at this in the future, the issue was the Prisma client was being re-created in each
beforeEach
rather than once in beforeAll
and then rebuilding the testing module6 replies
PPrisma
•Created by Ben on 4/16/2025 in #help-and-questions
'Too many clients' error when using NestJS and Jest even with a singleton Service
@Nurul (Prisma) Thank you for the link.
My issue is with running many integration tests in NestJS in quick succession.
Individually they run fine but when run as a complete test suite eventually I get a 'too many clients' error.
I suspect the issue is with setup and teardown but I'm running out of places to look 🙂
6 replies