Is there an existing issue for this?
I have searched the existing issues
Current behavior
This issue will happen with the bellow condition
The controller inject service A
Service A has using forwardRef for inject service B
Service A constructor call the async function for modified the service A property
=> From the controller, we can't access the latest value of that property. The value has been cached.
Minimum reproduction code
https://github.com/khanhx/nestjs-controller-forwardref-bug
Steps to reproduce
npm ci
npm run start
image
Expected behavior
The value from controller should match with value in the service A since we only have one instance of service A
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
No response
Packages versions
"@nestjs/common": "^10.3.2",
"@nestjs/core": "^10.3.2",
"@nestjs/platform-express": "^10.3.2",
"reflect-metadata": "^0.2.1",
"rxjs": "^7.8.1"
Node.js version
v18.18.2
In which operating systems have you tested?
macOS
Windows
Linux
Other
No response
https://github.com/nestjs/nest/issues/13826
Can anyone help me with this, It seem to be not related to any problem before. The code working as we have 2 instance of service but the constructor only call once
Contribute to khanhx/nestjs-controller-forwardref-bug development by creating an account on GitHub.