Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

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

Open
nguyendinhdoan opened this issue Oct 22, 2020 · 2 comments

Comments

@nguyendinhdoan
Copy link

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!

@trampi
Copy link

trampi commented Dec 7, 2020

Hi!

I have got the same problem here.

According to a ticket in react-native-code-push, this is probably due to filenames being utf-8 multibyte strings (in my case an image asset with the german mutated vowel "ß", which is two byte in utf-8). I renamed all files to only use ASCII characters and haven't been able to reproduce it in the last minutes.

see microsoft/react-native-code-push#1843

@nguyendinhdoan
Copy link
Author

I feel like the problems seems come from unzipping process after the package has been downloaded. I logged all files' size and path (from thousands of users) after unzipping (I did inside the onError callback) and I found that:

  • Sometimes it has /hotcodepush.json file, sometimes has not.
  • The size of /www/cordova.js is different from the one on my machine which is used to build and push to codepush repo. The other files look ok.
  • Sometimes the root directory / is empty <--- the unzipping process was interrupted somehow?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants