Ionic serve Unhandled Promise Rejection Warning

Dear ionic community,

I write this post because I have this problem a lot of times and I don’t know what cause these. I am running “ionic serve” for debug my project whithout any compiled error, but with this warning:

_UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'content' of null_

when my project is open in my webbrowser the page is blank and the console output is:

Failed to load resource: the server responded with a status of 404 (Not Found)
2http://localhost:8100/build/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8100/build/main.css Failed to load resource: the server responded with a status of 404 (Not Found)

The point is in this function:

  loadChannels(data){
    this.appParam.sqlChannels =[];
    data.forEach(element => {
                  this.appParam.sqlChannels.push(new Channel(element.ID, element.ChanName, "localhost"));
        }); 
           
  }

If i comment the line “this.appParam.sqlChannels.push(new Channel(element.ID, element.ChanName, "localhost"));” it is solve.

This happen to me other times with variables declaration such as “new [class]()” or with the declaration of a simple variable with "var a =1".

Could you tell me why is happening that??

thanks in advance

Sounds like some build error is resulting in the application not being built. There is probably something informative in the console.

I checked ionic console and chrome console, and just appear what I wrote:

Ionic console, compiles perfectly with the follow warning:

> _UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'content' of null_

Ionic launch a blank page with the following error in chrome console:

Failed to load resource: the server responded with a status of 404 (Not Found)

Any other place where I could check?

1 Like

Same here, after I updated Ionic
Console:

[12:10:34]  sass: node_modules/ionic-angular/themes/ionic.functions.scss, line: 109 
            The map color `grey` is not defined. Please make sure the color exists in your `$colors` map. For example: 
            $colors: ( grey: #327eff ); 
 L109:    @error $error-msg;

[12:10:34] sass failed

Chrome Console:

Failed to load resource: main.css the server responded with a status of 404 (Not Found)

Solve

I solved it. The problem was a circular reference between my models classes.

how to do that ? can u explain in more ?