Open
Description
It looks like the container crashes with a stack-overflow when a cyclic dependancy has been configured.
internal/console/constructor.js:241,
if (isStackOverflowError(e)),
^
RangeError: Maximum call stack size exceeded,
at Object.Console.<computed> (internal/console/constructor.js:241:9),
at Object.log (internal/console/constructor.js:282:26),
at Container.symbol2string (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:142:17),
at Container.getTokenString (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:134:25),
at Container.buildTraceMessage (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:126:31),
at Container.resolveInternal (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:36:29),
at /scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:99:74,
at Array.map (<anonymous>),
at Container.instantiateWithFactory (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:99:47),
at Container.resolveInternal (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:47:31),
at /scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:99:74,
at Array.map (<anonymous>),
at Container.instantiateWithFactory (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:99:47),
at Container.resolveInternal (/scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:47:31),
at /scm/hex/packages/sector/node_modules/container-ioc/dist/lib/container.js:99:74,
at Array.map (<anonymous>)
This can be reproduced by creating services A and B with their corresponding tokens and cross-injecting them:
provide service A
provide service B
A injects B
B injects A
I've worked around this issue in my project by avoid cyclic dependencies. Please let me know if you'd like me to create a minimal reproduction.
Thanks for the awesome package. It's helping a lot! 🦄
Metadata
Metadata
Assignees
Labels
No labels