React-native-code-push: Update contents fail data integrity check

Created on 28 Apr 2016  路  28Comments  路  Source: microsoft/react-native-code-push

Hi, hopefully this is just something I'm doing incorrectly. Lately I've had to deploy updates twice in a row to get them accepted. The first time I send one out, it always returns that I failed a data integrity check. This is the function I run to generate my release

/Users/tom/.nvm/versions/node/v4.2.1/bin/react-native bundle \
--reset-cache=true \
--entry-file=index.ios.js \
--platform=ios --dev=false \
--minify=true \
--bundle-output ./release/main.jsbundle \
--sourcemap-output ./release/main.map \
--assets-dest ./release

And then I follow up with

code-push release MyAppName ./release "*" --mandatory --deploymentName Staging

What other info might you need to help me out with this? :) Thanks

bug

All 28 comments

Note that if I run that top command twice (without changing anything the second time) and do a second deploy, it will work! I would think they would have the same checksum. Not sure what's going on.

@tomauty Is it the "this release is identical to the existing one" message that you're seeing? If so, that may be due to React Native packager caching issues.

Have you tried using the new release-react command in the CodePush CLI? It will handle the bundling process for you and will also make sure to clear the packager cache (via rm -rf $TEMP/react-*) before hand. Using it, you could simply type code-push release-react MyApp ios -m -t "*" to achieve the same affect as your two scripts.

Unfortunately no, it's this one:
The update contents failed the data integrity check.

I could try release-react, but my first command above should reset the packager cache anyway, I would think.

Good to know that I can shorten this build process though!

@tomauty OK thanks for clarifying. We'll investigate this issue since you definitely shouldn't be seeing it. In the meantime, are you unblocked? It's just a pain to have to release twice? (I just want to make sure I know the severity of the issue)

Yeah I don't mind releasing twice. If it helps, this also only happens when I'm updating from an existing codepush bundle. If I reinstall, I'll get the newest package without a second push.

OK cool, thanks for this detail @tomauty. We'll let you know the findings of investigating this issue.

@tomauty Can you inspect the "./release" folder for changes the second time u generate it using the react-native CLI? I have noticed that if you don't mkdir the "./release" folder first, sometimes the JS bundle doesn't appear or some assets go missing.

Hmm I can do that. I definitely keep the release folder there for my whole development cycle, but it is still worth checking out, for sure.

@tomauty Were you ever able to try out @geof90's suggestion? I'd like to try to resolve this, and we haven't been able to repro it :/ Thanks again and sorry for this annoyance.

Will be testing it now. In the past I've checked the release folder and it looked okay. I'll take a checksum too to be sure.

Edit - Failed integrity check the first time. Here's the checksum:
5f78678ff70af61d1997c3562e41dfe0
Obtained via find -s release -type f -exec md5sum {} \; | md5sum.

Second release has a different checksum than the first, I wonder if my method is bad. Anyway, will keep posted.

Second one did work. Also noted that the bundle size was much larger the second time around. Maybe I should be re-creating the release folder every time?

First bundle had size 2300095 bytes, latter had 8865515. Sorry for spam, just reporting all possibly relevant info.

Update! I think I know what the deal is here. I thought react-native bundle already had implemented reset-cache, however it turns out they _just_ added it in 0.26-rc.

https://github.com/facebook/react-native/commit/90f9f48498ce6174d022d85fd87ae71715adf0e7

I'll close this for now and rework my process to ensure cache is being reset, and will re-open if issues still occur. Thanks for the help!

@tomauty Ahh that makes a lot of sense! Thanks for confirming that. While you're re-working your process, I'd love any feedback on the release-react command if you decide to go with it. We're trying to improve it to be the simple solution for most apps. Thanks!

I've been able to get this all to work by stopping the packager when running my release command, and also recreating the release folder each time. Currently it'll be difficult to move to release-react because of the inferred targetBinaryVersion. Working with TestFlight/Prod builds means I update that multiple times but might deploy to a lower version. Still in the evaluation phase though, and I do see I can specify it manually.

You can actually "disable" the version inference by explictly passing the "--targetBinaryVersion" flag when calling release-react.

I just ran into this problem, recreating the ./release folder fixed this problem!

I keep running into this problem. This is what I see.

2016-08-17 14:39:28.140 [info][tid:com.facebook.react.JavaScript] [CodePush] Checking for update.
2016-08-17 14:39:28.549 [info][tid:com.facebook.react.JavaScript] [CodePush] Downloading package.
2016-08-17 14:39:28.780 [info][tid:com.facebook.react.JavaScript] [CodePush] An unknown error occurred.
2016-08-17 14:39:28.780 [info][tid:com.facebook.react.JavaScript] [CodePush] The update contents failed the data integrity check.

I have tried code-push release-react and react-native bundle with code-push release separately. I also cleaned the release folder and recreated it. Nothing helped.

Every now and then, it is able to update. But not all the time. Does it depend on how often we release versions?

Hi @rahuljiresal, this normally indicates some kind of issue where the hash of the package computed on the server doesn't match the hash computed on the client. Would it be okay with you if I inspected the contents of your package? If so, could you email me at [email protected] with your deploymentKey and release label?

@silhouettes Thanks for the prompt reply. Just sent you an email.

Okay, found the problem. @silhouettes Will submit a PR soon and tag you.

Hi @lostintangent @geof90 @silhouettes ,i run into same error. But in my case, after react-native bundle ,i have to add some js files to directory which i would code-push later.Because of that,i get "Update contents fail data integrity check".Is there a way to solve this problem?.Or is there a way to bundle some js files as assets instead of bundle into index.ios.bundle. Forgive my bad English.If you still need me to provide anything, please let me know.Thanks.

And if i just react-native bundle and code-push release without any extra operations such as I described above,code push will be performed as expected.

Hi, @bluerunrun, and thank you for your question. Could you, please, provide us more details about your problem? It would be nice, if you will submit new issue and fill technical information needed for us to help you.

I also encountered this problem. I have compiled it with a Mac computer. So there is a .DS_Store file in the folder. After I delete this file and publish it using codepush, the problem is not there. I can try it.

i also has the problem , and only found it in ios. How to solve it? codePush's update alway failed in ios.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

huangkaiw3n picture huangkaiw3n  路  58Comments

marf picture marf  路  25Comments

marcmo picture marcmo  路  26Comments

niftylettuce picture niftylettuce  路  28Comments

ps-swaroop picture ps-swaroop  路  48Comments