Vendor.js: "Cannot read property 'loaded' of undefined" on Logout

Hey guys,

when logging out a user on a device (not in ionic serve) I receive the following error:
vendor.js:1 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'loaded' of undefined(…)

I don’t use a variable named loaded in any of my pages. I think it realy comes from vendor.js.

Do you have any idea how to deal with this?

Ionic Info:

cli packages: (D:\path)

    @ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.0.2
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.5.3

System:

    Android SDK Tools : 25.2.5
    Node              : v8.2.1
    OS                : Windows 10
    npm               : 5.3.0

loaded is a property of some undefined object

Yes. However, it’s not a property that I defined or that I somehow call in my code.

What code is executed when “logging out a user”?

homePage:

performLogout(){
   this.authService.logoutUser().then(() => {
      this.nav.setRoot(Page2);
   });
}

authService:

constructor(public afAuth: AngularFireAuth,
            public db: AngularFireOfflineDatabase) { }

logoutUser() {
    this.db.reset();
    return this.afAuth.auth.signOut();
  }

The this.db.reset() is an undocumented feature of AngularFire2-offline that I need to use to prevent Firebase permission-denied-errors.

1 Like

I wonder if it’s causing your problem somehow, because there is an instance of loaded in here.