microsoft / code-push

A cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices.
https://microsoft.github.io/code-push/
Other
4.36k stars 495 forks source link

How to replicate the issue "The update contents failed the data integrity check"? #746

Closed nguyendinhdoan closed 3 years ago

nguyendinhdoan commented 3 years ago

I'm using CodePush for my cordova project. I see this message in the console:

The update contents failed the data integrity check

The weird thing is that it is not happening to all users, only 3% of my users are getting problem and I cannot replicate it locally (it happened to me too but just 5, 6 times of about 500 times I did release). Once I've got this issue, the app is unable to get any new update, it gets stuck at the old version forever even when I release a new version.

I check out the source and found it was due to: computedHash !== newUpdateHash

if (computedHash !== newUpdateHash) {
    errorCallback(new Error("The update contents failed the data integrity check."));
    return;
}

I incline to the computed hash at client because it works well for many users so that it cannot be due to the hash at server. Perhaps, ios or the plugin create extra files after downloading & unzip?

Here are my packages:

"dependencies": {
    "code-push": "3.1.5",
    "cordova-common": "3.2.1",
    "cordova-gen-icon": "0.4.2",
    "cordova-ios": "5.0.0",
    "cordova-plugin-app-version": "0.1.9",
    "cordova-plugin-appcenter-analytics": "0.5.1",
    "cordova-plugin-appcenter-crashes": "0.5.1",
    "cordova-plugin-appcenter-shared": "0.5.1",
    "cordova-plugin-ble-central": "1.2.2",
    "cordova-plugin-code-push": "1.12.5",
    "cordova-plugin-compat": "1.2.0",
    "cordova-plugin-deeplinks": "1.1.1",
    "cordova-plugin-device": "2.0.3",
    "cordova-plugin-dialogs": "2.0.2",
    "cordova-plugin-file": "4.3.3",
    "cordova-plugin-file-transfer": "1.6.3",
    "cordova-plugin-inappbrowser": "4.0.0",
    "cordova-plugin-network-information": "2.0.1",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.1",
    "cordova-plugin-whitelist": "1.3.4",
    "cordova-plugin-zip": "3.1.0",
    "fs-extra": "9.0.1",
    "phonegap-plugin-push": "2.3.0",
    "shelljs": "0.8.3",
    "underscore": "1.9.1",
    "unorm": "1.6.0",
    "xcode": "2.0.0"
  },

I need to replicate it locally then I could find out a solution. Any help would be appreciated. Thanks!