question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Angular 10] Mat Dialog throws error after production deployment

See original GitHub issue

🐞 bug report

Affected Package

I’ve recently upgraded to Angular 10. The issue is caused by package @angular/core.

Is this a regression?

I never faced this issue in previous versions.

Description

I have a dialog component and inside which I’ll be loading other few components (say A, B, C). Now when I remove all component’s selectors & have only text alone in my dialog component, it renders successfully. But if I use the selector of A, B & C’s component, then it is throwing the below error.

During error, only half the dialog width is rendered & contents inside that has not loaded at all. It throws exception in core.js file as below.

ERROR TypeError: Cannot read property 'selectors' of null

I get this error only when using ng build --prod or ng serve --prod. (ie, only when using --prod). Issue didn’t appear in normal ng serve in development mode. Hence there is no way I can reproduce this issue in stackblitz.

Our project is a bit complex and we did not find the exact cause of the issue due to which I could not able to create new repository to reproduce the issue. The error message thrown is not so helpful due to which I am helpless.

image

πŸ”₯ Exception or Error



ERROR TypeError: Cannot read property 'selectors' of null
    at core.js:8052
    at so (core.js:7854)
    at core.js:13632
    at Module.gl (core.js:13668)
    at template (my-dialog.component.html:1)
    at Xi (core.js:7329)
    at Wi (core.js:7138)
    at ko (core.js:8382)
    at core.js:6997
    at Wi (core.js:7163)

🌍 Your Environment

Angular Version:


Angular CLI: 10.0.1
Node: 10.15.0
OS: win32 x64

Angular: 10.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.1
@angular-devkit/build-angular     0.1000.1
@angular-devkit/build-optimizer   0.1000.1
@angular-devkit/build-webpack     0.1000.1
@angular-devkit/core              10.0.1
@angular-devkit/schematics        10.0.1
@angular/cli                      10.0.1
@angular/material                 10.0.1
@ngtools/webpack                  10.0.1
@schematics/angular               10.0.1
@schematics/update                0.1000.1
rxjs                              6.5.5
typescript                        3.9.6
webpack                           4.43.0


Anything else relevant? #37323 <- this ticket seems similar to my issue but unfortunately it’s been closed because of lack of information. Please do comment if you need any other information from my side.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
msalmankarimcommented, Aug 13, 2020

I am also facing this same issue.

2reactions
kbtganeshcommented, Aug 15, 2020

@atscott

I CLEARLY TOLD, it can’t be reproduced in stackblitz since it’s occurring only when doing build --prod. There is no proper error thrown hence we couldn’t find the root cause. Without knowing the actual problem how can you expect it to be reproduced in new github repo?

I’ve told you the exception error & I am ready to debug each line by line in core.js file as well & tell you at which line in your core.js file is throwing exception. What else you need?

Please do re-open the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - MatDialog not displayed correctly - Stack Overflow
After banging my head against the wall all day I discovered a circular dependency that for some reason hadn't been throwing an error....
Read more >
NG0100: Expression has changed after it was checked - Angular
Angular throws an ExpressionChangedAfterItHasBeenCheckedError when an expression value has been changed after change detection has completed. Angular onlyΒ ...
Read more >
Building a web application with Angular and Firebase
At the end of the codelab we'll deploy the app to Firebase Hosting using the Angular CLI. b23bd3732d0206b.png. What you'll learn. How to...
Read more >
Error Handling with Angular 8 - Tips and Best Practices - Rollbar
Once you deploy your application to a production environment, you no longer have access to the console log. That's because the code is...
Read more >
48 answers on StackOverflow to the most popular Angular ...
How to bundle an Angular app for production; BehaviorSubject vs Observable? @Directive v/s @Component in Angular; Angular HTTP GET with TypeScript error ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found