Closed DanishaRegil closed 4 years ago
On taking a deeper look into the issue was able to see, only few of the build files where download before which the loader worker has stopped.
Any idea on what would have caused this interruption
Check the chcp.manifest
file. The plugin only downloads files that are listed in that file.
Be aware that this cordova plugin is no longer supported:
https://github.com/nordnet/cordova-hot-code-push/issues/371
Though the chcp.manifest has got the list of all build files, only 5 or 6 files get downloaded each time, any clue on it
One last thing I would check is if the hash
in the chcp.manifest file has changed. The plugin downloads the file only when the hash is different.
Ya that explains, so Only If the hash file changes in chp.manifest, the plugin downloads, but as per the logs, post downloads the app is getting served from external location: /data/user/0/io.ionic.starter/files/cordova-hot-code-push-plugin/2020.01.07-04.17.30/www/index.html instead of the previous http://localhost, If that is case the new location might have only the updated files and not all the files right.
Correct me if my understanding is wrong or how to address it
as when launched from external location post update I get all 404 errors below is the code snippet
2020-01-07 06:28:49.046 27495-27610/io.ionic.starter D/CHCP: Loading file: http://**********/updates/cordova_plugins.js 2020-01-07 06:28:50.835 27495-27610/io.ionic.starter D/CHCP: Loading file: http://**********/updates/main-es2015.js 2020-01-07 06:28:52.796 27495-27610/io.ionic.starter D/CHCP: Loading file: http://**********/updates/main-es2015.js.map 2020-01-07 06:28:54.427 27495-27610/io.ionic.starter D/CHCP: Loading file: http://**********/updates/main-es5.js 2020-01-07 06:28:55.295 27495-27610/io.ionic.starter D/CHCP: Loading file: http://**********/updates/main-es5.js.map 2020-01-07 06:28:55.977 27495-27610/io.ionic.starter D/CHCP: Loader worker has finished 2020-01-07 06:28:55.978 27495-27610/io.ionic.starter D/CHCP: Update is ready for installation: 2020.01.07-04.17.30 2020-01-07 06:28:55.986 27495-27495/io.ionic.starter D/SystemWebChromeClient: http://localhost/main-es2015.js: Line 549 : fetched Update 2020-01-07 06:28:55.986 27495-27495/io.ionic.starter I/chromium: [INFO:CONSOLE(549)] "fetched Update ", source: http://localhost/main-es2015.js (549) 2020-01-07 06:28:55.995 27495-27495/io.ionic.starter D/SystemWebChromeClient: http://localhost/main-es2015.js: Line 552 : UpdateAvailableForInstallation 2020-01-07 06:28:55.995 27495-27495/io.ionic.starter I/chromium: [INFO:CONSOLE(552)] "UpdateAvailableForInstallation ", source: http://localhost/main-es2015.js (552) 2020-01-07 06:28:55.996 27495-27599/io.ionic.starter D/CHCP: Dispatching Before install event 2020-01-07 06:28:56.606 27495-27633/io.ionic.starter D/CHCP: Update is installed 2020-01-07 06:28:56.612 27495-27495/io.ionic.starter D/CordovaWebViewImpl: >>> loadUrl(file:///data/user/0/io.ionic.starter/files/cordova-hot-code-push-plugin/2020.01.07-04.17.30/www/index.html) 2020-01-07 06:28:56.614 27495-27495/io.ionic.starter D/CHCP: Loading external page: /data/user/0/io.ionic.starter/files/cordova-hot-code-push-plugin/2020.01.07-04.17.30/www/index.html
initializeApp() { this.platform.ready().then(() => { this.statusBar.styleDefault(); this.splashScreen.hide(); window["thisRef"] = this; this.fetchUpdate(); }); }
fetchUpdate() {
const options = {
'config-file': '****/updates/chcp.json'
};
this.chcp.fetchUpdate(options).
then(
(value:any)=>{
this.chcp.isUpdateAvailableForInstallation().
then((value:any)=>{
this.chcp.installUpdate().then((res:any)=>{
console.log(res);
}
)
})
},(error:any)=>
{
console.log("e =>"+error)
});
}
I have no clue. Very strange that the url changes. I used this plugin for about 2 years before they deprecated it and I removed it from my application.
My code looked very similar. The only difference, in my application I did not call isUpdateAvailableForInstallation
.
fetchUpdate() {
const options = {
'config-file': ENV.UPDATE_URL
};
chcp.fetchUpdate(this.updateCallback.bind(this), options);
}
updateCallback(error, data) {
if (!error) {
chcp.installUpdate(error => {
if (error) {
console.log(error);
}
});
}
}
I don't use hot updates anymore. I switched to Capacitor and I didn't find a self hosted solution that works with Capacitor.
For Cordova application I would check out Microsoft's CodePush. Ionic Appflow also has a solution.
And this looks interesting: IonPush
Ya agree, Microsoft Code Push works absolutely fine, but im trying to work around without Microsoft.
But with upgrading of Ionic 4 even similar issue was reported in the Microsoft code push and was later fixed. https://github.com/Microsoft/cordova-plugin-code-push/issues/486 https://github.com/microsoft/cordova-plugin-code-push/pull/491/commits/832d56cd975db3c45781dbc88d1a976ad7cc3092
I see, there was a problem. Too bad that they abandoned the cordova-hot-code-push project. Would be great to have a self-hosted solution.
Post placing the updated build in the remote url and relaunching of app, blanks out