[SOLVED] Uncaught (in promise): false (nightly-build / RC.4)


#1

When I open my massive wizard (one page component, many slides, too many components, many directives etc.) I’ve got the following error the very first time I load everything:

Error: Uncaught (in promise): false
at s (polyfills.js:3)
at s (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (ng_zone.js:227)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
at i (polyfills.js:3)
at HTMLElement.invoke (polyfills.js:3)

Which brings me absolutely no valuable informations to find out what’s happening.

Any idea how could I get more stacktraces to at least have a start point to find out what is the problem?


#2

I opened an issue, turns out it’s a mix between loading and navcontroller in the nightly-build which produce the error


#3

jsayol find a quick win fix and created a PR

if anyone of the ionic team read this, plz push the PR, it’s a super fast quick win for the quality of RC.4


Ionic 2 rc4 Loading dismiss error
#4

am getting the same error but for just setting the rootPage !!

the code in the app.component.ts

af.auth.subscribe( user => {
if (user) {
this.rootPage = ContactPage;
} else {
this.rootPage = LoginPage;
}
});

its just angularFire auth check, and as soon as the ContactPage is Showen, i receive the following Error

Runtime Error
Uncaught (in promise): false
Stack
Error: Uncaught (in promise): false
at s (http://localhost:8100/build/polyfills.js:3:4211)
at s (http://localhost:8100/build/polyfills.js:3:4034)
at http://localhost:8100/build/polyfills.js:3:4574
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723)
at Object.onInvokeTask (http://localhost:8100/build/main.js:35478:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659)
at e.runTask (http://localhost:8100/build/polyfills.js:3:7083)
at i (http://localhost:8100/build/polyfills.js:3:3671)
at HTMLElement.invoke (http://localhost:8100/build/polyfills.js:3:10876)
Ionic Framework: ^2.0.0-rc.4
Ionic Native: 2.2.11
Ionic App Scripts: 0.0.48
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 6.9.2
OS Platform: Windows 8.1
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36


#5

Seems that they merged a solution for that task in the nightly, but I was unable to test it because this I face another problem elsewhere :frowning:


#6

In my case, apparently it was because of the “dismissOnPageChange: true” I was using in loadingController.create().

Following code was giving me the error:

    let loader = this.loadingController.create({
        content: 'loading...',
        dismissOnPageChange: true
    });

    loader.present();
    this.gameService.getGameInfo(game.gameId)
        .subscribe(t => this.navCtrl.push(TeamPage, game.team));

I read somebody’s comment on the link provided by reedrichards above and changed my code to remove “dismissOnPageChange” like below and it worked absolutely fine.

    let loader = this.loadingController.create({
        content: 'loading...'
    });

    loader.present().then(() => {
        this.gameService.getGameInfo(game.gameId)
            .subscribe(t => {
                this.navCtrl.push(TeamPage, game.team);
                loader.dismiss();
            });
    });

Wasted lot of time to fix this. :frowning:


#7

Thank you! I spun my wheels on this before finding your note.


#8

I was experiencing this issue and kept the dismissOnPageChange in place and removed my intentional dismiss directives. I was lucky, I suppose, because all my actions forced the current page to pop.


#9

Last nightly, 2.0.0-rc.4-201701062325, solve this issue. Gonna then be fixed in RC.5


#10

This problem came back on me (in rc.4 and 2.0.0) and I found this simple, clean solution by jigsaxis in https://forum.ionicframework.com/t/runtime-error-after-upgrade-to-rc4/73773/9

Change

loading.dismiss();

to

loading.dismiss().catch(() => {});


#11

[solved]
i have same problem because i called dismiss louder many time
solution is to dismiss louder only one time


#12

Check your code where you have used
loader.dismiss();
I think somewhere it uses more than ones in same block Or it dismiss unexpectedly.


#13

This solved the problem for me. Thanks!


#14

any solution for this error: runtime error uncaught in promise object

I got this error but I dont know where is the problem any ideas to solve this please


#15

My issue was happening because I was trying to dismiss loading twice.


#16

I’m actually coding with Ionic 2 / Angular 2 and had the same error with the Promise,
Here is the code that worked for me:

import { Injectable } from '@angular/core';
import { LoadingController } from 'ionic-angular';

@Injectable()
export class LoadingService {
  private loader;

  constructor(public loading: LoadingController) {
    this.init();
  }

  init() {
    this.loader = this.loading.create({content:'Loading...', duration: 30000});
  }

  activate() {
    if (this.isLoaderUndefined())
      this.init();
    this.loader.present();
  }

  deactivate() {
    if (!this.isLoaderUndefined())
      this.loader.dismiss().catch(() => console.log('ERROR CATCH: LoadingController dismiss'));
    this.loader = undefined;
  }

  isLoaderUndefined(): boolean {
    return (this.loader == null || this.loader == undefined);
  }
}

Hope that it helps :slight_smile:


#17

My fix for the same problem (the loader would not dimiss with the code solutions above)

this.loading.dismiss()
                .catch((reason: any) => {
                    this.loggerService.error('SpinnerService - loading.dismiss()', reason);
                    **this.loading.dismissAll();  //had to add this or it would not dismiss**
                });

#18

Thanks, This worked…


#19

This worked for me. Not sure what the cause of the problem was in the first place, as this issue only happened one place in our code.


#20

This can also happen if you have a bad chain of events or loop. For example, if use a loadingController with no dismiss, because the if() statement calls a value that doesn’t exist yet (remember to use then() and promises for that).