2

This is not the first time I work with Inversify, but never had a problem like such. Currently what I have in my project is just a bunch of decorated (properly, constructor injections) services, therefore I assume it's failing on building the metadata.

I'm getting Error: @inject called with undefined this could mean that the class X has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation. whenever I start the application (bear in mind - I don't have a container yet).

Following the "circular dependency problem" part I built a dependency graph using dependency-graph package and it shows no circular dependencies in my project, it also managed to properly generate registration order.

I'm wondering if there's any way to avoid using LazyServiceIdentifier everywhere in the project?

Additionaly I'm trying to understand how is it even possible for this error to occur when using constructor injection (and having no circular dependencies of course)?

pzaj
  • 1,062
  • 1
  • 17
  • 37
  • Hi Bro! Did you find the decision? – jocoders Jan 22 '20 at 10:42
  • 1
    @jocoders I decided to move to injection based on enum (rather than class directly) and it seems to work fine now. Although not ideal, it's better than nothing. – pzaj Jan 23 '20 at 09:36

0 Answers0