AppVersion in Ionic 5 Community Edition utterly Poked?

So whenever I include the AppVersion pluggin, it seems to completely corrupt itself or break the Ionic App as soon as the app finishes and auto update. The pluggin works up until that point. After that point it keeps crashing the application with “local host not found” errors.

So basically the pluggin is utterly useless as soon as an update is downloaded. This is the errors out of the console that it produces once it gets into this state:

[ng] [console.log]: "Current: versionCode: 15 versionName: 0.0.15"
[ng] [console.log]: "update: versionCode: 15 versionName: 0.0.15"
[ng] [console.error]: "Unhandled Promise rejection:" "Failed to fetch" "; Zone:" "<root>" "; Task:" "Promise.then" "; Value:" {} "TypeError: Failed to fetch"
[ng] [console.log]: "Current: versionCode: 15 versionName: 0.0.15"
[ng] [console.log]: "update: versionCode: 15 versionName: 0.0.15"
[ng] [console.error]: "Unhandled Promise rejection:" "Failed to fetch" "; Zone:" "<root>" "; Task:" "Promise.then" "; Value:" {} "TypeError: Failed to fetch"

This is the error in the app:

image

The only way to get the app working again is to uninstall it, and then reinstall it again. It won’t launch, pull auto updates or anything, the app it just utterly broken from that point.

Here is the code I used to get the version if it is of any use.

  private _getVersionStr(): void {
    if (this._vogiUtil.runningOnNative()) {

      this._appVersion.getVersionNumber()
        .then( (value: string) => {
          this.verStr = value;
        })
        .catch( (reason: any) => {
          console.error(reason);
          this.verStr = constants.VER_ERROR;
        });
    }

    this.verStr = constants.VER_DEV;
  }  

Has anyone else experienced this issue or have a solution to this?

1 Like