A minimum reproduction repository to show off an error wth circular dependencies and implicit request scopes
When using a forwardRef
to resolve a circular dependency between two services, and one of the services injects a REQUEST scoped dependency, the other dependency does not see the original one as request scoped, and as such, cannot call the methods of the first dependency.
To display this, I created three dependencies
FooService
BarService
BazService
FooService
and BarService
are circularly dependent. BazService
is REQUEST
scoped due to injecting REQUEST
, but does not use scope: Scope.REQUEST
in the @Injectable()
decorator. FooService
injects BazService
making it implicitly REQUEST
scoped.
When an HTTP request is made to /
, FooService
calls to BarService
, but AppController
cannot call getBar
of FooService
due to the implicit request scoping, and the FooService
not actually being created on the request.