-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Open
Copy link
Labels
needs triageThis issue has not been looked intoThis issue has not been looked into
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
I have a request scoped service & controller, that both inject a transient service that itself also injects a transient service. I am observing that the nested service instance created is being reused for both instances of the first transient service.
Service (Request) injects Service (Transient, instance #1) injects NestedService (Transient, instance #1)
Controller (Request) injects Service (Transient, instance #2) injects NestedService (Transient, instance #1)
Minimum reproduction code
https://github.com/stineslenea/logger-transient-example
Steps to reproduce
npm i
npm run build
npm run start
call http://localhost:3000/test and check the log
Expected behavior
I expect both transient services get instances created for both controller and service.
NestJS version
11.1.6
Packages versions
{
"dependencies": {
"@nestjs/common": "11.1.6",
"@nestjs/core": "11.1.6",
"@nestjs/platform-express": "11.1.6",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@nestjs/cli": "latest",
"@nestjs/schematics": "latest",
"@nestjs/testing": "latest",
"@types/node": "^20.3.1",
"typescript": "^5.1.3"
}
}
Node.js version
20.12.2
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
Metadata
Metadata
Assignees
Labels
needs triageThis issue has not been looked intoThis issue has not been looked into