NestJS 11 creates multiple DB connection instances in Nx monorepo after module resolution change #35511
Unanswered
kelp-vishal
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I upgraded my NestJS app from v10 to v11, and now my Nx monorepo is creating multiple instances of the same dynamic database module. Because of this, I’m getting too many clients already errors from PostgreSQL.
In NestJS 10, dynamic modules were deduplicated by hash, but in NestJS 11 the module resolution algorithm now uses object references instead. In my repo, several feature modules depend on each other, and some shared modules import the DB module more than once indirectly.
What is the recommended way to structure this in NestJS 11 so that I keep only one DB connection / DataSource instance without using deep-hash in tests?
I’m looking for the correct architectural fix, not a test-only workaround.
Beta Was this translation helpful? Give feedback.
All reactions