Update contents fail data integrity check
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
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?