nest: [9.x.x] Duplicate Provider names don't get shown in REPL-debug() function
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
Given the following Diagram:
graph TD;
AppModule((AppModule))-->CatModule((CatModule))
AppModule-->AppService_A>AppService]
AppModule-->foo_A>provide: 'Foo', useValue: 'bar']
CatModule-->AppService_B>AppService]
CatModule-->foo_B>provide: 'Foo', useValue: 'barbaz']
CatModule-->CatService>CatService]
Both the AppModule and CatModule have providers with the same name but different implementations/instances.
When using the NestJS repl() method and print a debug() statement in order to list the application context, the AppService & Foo provider does not get listed within the CatModule.
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG [NestFactory] Starting Nest application...
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG [InstanceLoader] CatModule dependencies initialized
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG [InstanceLoader] AppModule dependencies initialized
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG REPL initialized
> debug()
AppModule:
- controllers:
◻ AppController
- providers:
◻ AppService
◻ Foo
CatModule:
- providers:
◻ CatService
Minimum reproduction code
https://github.com/BrunnerLivio/nestjs-repro-duplicate-provider-repl
Steps to reproduce
- npm ci
- npm run start:dev
- Write
debug()within REPL console
Expected behavior
Should list all providers
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG [NestFactory] Starting Nest application...
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG [InstanceLoader] CatModule dependencies initialized
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG [InstanceLoader] AppModule dependencies initialized
[Nest] 5340 - 07/08/2022, 11:18:42 AM LOG REPL initialized
$ debug()
AppModule:
- controllers:
◻ AppController
- providers:
◻ AppService
◻ Foo
CatModule:
- providers:
◻ CatService
+ ◻ AppService
+ ◻ Foo
Package
- I don’t know. Or some 3rd-party package
-
@nestjs/common -
@nestjs/core -
@nestjs/microservices -
@nestjs/platform-express -
@nestjs/platform-fastify -
@nestjs/platform-socket.io -
@nestjs/platform-ws -
@nestjs/testing -
@nestjs/websockets - Other (see below)
Other package
No response
NestJS version
9.0.0
Packages versions
platform-express version : 9.0.0
schematics version : 9.0.1
testing version : 9.0.0
common version : 9.0.0
core version : 9.0.0
cli version : 9.0.0
Node.js version
16.15.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (14 by maintainers)
Sorry for this issue. You just released an AWESOME Nest V9 and now I already have to report an edge case 😛 Low prio obviously (in case you consider this as unexpected behavior), I am just playing dumb user haha
@micalevisk that’s how
NestApplicationContextinstance behaves by default (this isn’t a bug)Guys, what’s the solution for this issue? I can code it but I didn’t understood what needs to be done