#Suggestion for tools to track down circular dependencies?

6 messages · Page 1 of 1 (latest)

deep mortar
#

I am getting the error, "ReferenceError: Cannot access 'ConversationService' before initialization" when trying to inject a service. I have solved many circular dependency issues in the past but this has me stumped. I even used https://github.com/jmcdo29/nestjs-spelunker to pull the dependency graph and has very carefully gone over it several times and can't find any circular dependencies. forwardRef also doesn't not fix it. Can anyone suggest tools to help track it down or could there be a non-circular dependency issue causing this?

GitHub

A NestJS Module for generating a NestJS Applications Module Dependency Graph. - GitHub - jmcdo29/nestjs-spelunker: A NestJS Module for generating a NestJS Applications Module Dependency Graph.

hexed rain
#

You may want to look at madge as it can also help determine circular dependencies

kind sable
hexed rain
deep mortar
#

those both seem to be focused on js import dependencies rather than nestjs injection dependencies. It had not occured to me that could be causing it

deep mortar
#

That did it! Thank you so much. Had an import that was just bringing a const from a service. Since the service wasn't instantiated it wasn't part of the dependency inject system. So lesson is need to remember to pay attention to both nestjs dependency circulars and regular js circulars!