#NG0200 Error on Sentry

7 messages · Page 1 of 1 (latest)

vital mulch
#

Lately we're getting quite a few NG0200 errors on Sentry. It's not really reproducible from our side. One thing I noticed is that the issue is mostly a combination of android 12 + facebook browser.

According to the docs, NG0200 is related to circular dependencies. But I would imagine that should not be related to the browser in use and also surface on other browsers. Also I assumed that in-app browsers on android use the chrome runtime and would be fairly up to date.

Is there any way to debug this further? The stacktrace is not particularly helpful and without a way to reproduce this, it seems borderline impossible to narrow this down.
Thankful for any pointers 🙂

violet willow
#

Hey, I can't help you with that, but maybe a particular page, or particular chunk download order leads to circular dependency.

I don't recall fully what we've had on our end, but I recall that there was a circular dependency that was giving an error only when an application was initialized from Page X, but not from Page Y. So if user entered Page Y, and then Page X - it was ok. if user entered Page X - it was not.

Maybe you've got similar issue.

vital mulch
#

Thank you, I'll see if I can find any pattern like this.

One confusing thing is the component that sentry complains about definitely doesn't have a circular dependency. The component only imports on one other component and that other component only imports the CommonModule.

fossil relic
#

The NG0200 error, as it is described in the documentation, isn't about a circular dependency between components or javascript modules. It's a circular dependency in DI, i.e. service A injects service B, which injects service C, which injects service A for example.

honest rampart
#

try find CD by madge. npx madge --circular --extensions ts

finite lark
#

Madge finds cycles in ES modules. It does not find cycles Angular DI providers, which is what the problem is when you get NG0200

vital mulch
#

Hmm there are only 2 services in the component that Sentry flagged. Service A and Service B. A depends on B. But B only depends on Angular injection tokens, since it's a low level service that specifically is designed for not having any application dependencies.

madge only reports our recursive components that we use to render some dynamic content with. No services at all, and not the component that is throwing the exception.