After modifying some features and stuff in our app we just released both new versions over the air and all goes ok. The app discover the update accordingly, then installs it and so restart the app.
Everything was ok until i realize that when i restart the app it kind of roll-back to the default store version (w/o our new updates). Any suggestion would be appreciated.
Obs: When it auto-roll-back, the app just don't alert again about the update just released.
(The more info the faster we will be able to address it!)
Hey @vedovato, is your root component wrapped? Like this: https://github.com/Microsoft/react-native-code-push#plugin-usage
Hey @silhouettes thanks for your reply. No, it isn't wrapper but it's "working".
Couple of questions:
Hi @vedovato:
The wrapper just calls .sync(), but the difference is that it also calls notifyAppReady() in the root componentDidMount. If this function is not called in the first run of a CodePush update to 'rubber stamp' it as having launched successfully, the update will be rolled back the next time the app is started.
So, to solve your problem, I suggest you just add a call to that function as soon as the update is loaded. Does that solve your issue?
Well, i think it didn't @silhouettes. Could you take a look at my code? I think everything is ok and no errors/warnings are shown: Btw, it is working fine in Android and just iOS roll-back as mentioned.
Here's the actual code: https://codepaste.net/ehp1a1
Ps: I tried to call codepush from decorator and also pasted above a method version which's commented inside the componentDidMount.
@vedovato, do you still experiencing the issue? Please let me know if you see any issues.
Yeah, i do @sergey-akhalkov but i think it's something with wix-react-native-navigation not codepush itself. I'm not being able to wrap my root component..
@vedovato, could you please provide me minimal version of the app (https://codepaste.net/ehp1a1 link does not work for me) where the issue reproduces? So I will investigate it and try to help you.
Hey, ok i'd appreciate that @sergey-akhalkov. Here goes the code snapshot.
Thank you!
@vedovato, I have a quick look on your code snapshot and I could advice you the following:
News = codePush({ installMode: codePush.InstallMode.ON_NEXT_RESUME })(News); line here: https://gist.github.com/vedovato/d4405ff36db140125e607fdec6d66621#file-news-js-app-news-screen-L112Please let me know if it helps or if you see any issues.
@vedovato - hi, do you have a chance to look at this?
I'll have a look into it soon, @max-mironov @sergey-akhalkov. Sorry for delaying.
@vedovato - any updates about this? Just a friendly ping :)
Last week i was in trouble with apple certificates so i couldn't test it properly in my phone and this is very important to us so i'll try my best to feedback you very soon. Thank you for pinging me again, @max-mironov
Reiterating, i'll be able to only see this tomorrow in the afternoon :/
@vedovato
No problem, it's not something super urgent. Please verify it at any convenient time for you :) We just wanted to be sure that the issue is fixed for you.
@vedovato, closing this for now, please feel free to reopen if the issue still reproduces or if you have any questions.
Had the same problem, this is what worked for me https://github.com/Microsoft/react-native-code-push/issues/875
@sergey-akhalkov I'm currently facing this issue no matter what configuration I have tried.
React Native: 0.45.1
RN Code Push: 3.0.1-beta
After releasing a new version in Staging, there is no way I can update the application version since it's always rolling back with the debug message:
[CodePush] Checking for update.
[CodePush] An update is available, but it is being ignored due to having been previously rolled back.
[CodePush] App is up to date.
I've also tried the solution @grigored has proposed, but neither this approach has helped update the application.
Do you have any idea how can I resolve this issue?
My root component is like:
let codePushOptions = {
installMode: codePush.InstallMode.ON_NEXT_RESUME,
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME
}
class Root extends Component {
componentDidMount() {
codePush.sync()
}
codePushDownloadDidProgress(progress) {
console.log(progress.receivedBytes + ' of ' + progress.totalBytes + ' received.')
}
render() {
return <Main />
}
}
Root = codePush(codePushOptions)(Root)
export default Root
In my case messing around with codePush.sync() brought only problems. What if you remove the part in componentDidMount() part?
@grigored also tried commenting out the componentDidMount() but the same problem occured to me. 馃槥
@sergey-akhalkov @grigored I've also tried a pure react-native project with just react-native and react-native-code-push as dependencies, but the exact same error occurs. I'm running both apps with react-native run-ios using packager.
Hi @kwnccc, thanks for reaching us. Could you please share pure project source code with me? So I'll be able to investigate it and find out the root cause of the issue.
@sergey-akhalkov yeah sure, what i did is to actually create a new RN application.
react-native init TestingCodePush && cd TestingCodePushcode-push app add TestingCodePush-iOS ios react-native (being already authorised)npm install --save react-native-code-push (v5.0.0-beta, my actual project is using v3.0.1-beta)index.ios.js to the following:import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import codePush from "react-native-code-push";
export default class TestingCodePush extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
);
}
}
TestingCodePush = codePush(TestingCodePush)
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('TestingCodePush', () => TestingCodePush);
react-native run-ios -> opened the app in the emulator -> enable js remote debuggingcode-push release-react TestingCodePush-iOS ios[CodePush] Checking for update.
[CodePush] An update is available, but it is being ignored due to having been previously rolled back.
[CodePush] App is up to date.
Let me know if this helps.
@kwnccc, thanks for sharing the source code and repro steps. I can see that the source code is fine, but I can see an issue in your repro steps - you shouldn't test CodePush updates in Debug mode while react-native packager is working, please take a look at this NOTE from official docs:
NOTE: CodePush updates should be tested in modes other than Debug mode. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply.
If you want to test CodePush updates in development/debug mode for iOS you should do the following:
jsCodeLocation = [CodePush bundleURL];
//#ifdef DEBUG
//// jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
// jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios"fallbackResource:nil];
//#else
// jsCodeLocation = [CodePush bundleURL];
//#endif
//
node_modules/react-native/scripts/react-native-code.sh聽the lines: # if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
# echo "Skipping bundling for Simulator platform"
# exit 0;
# fi
Please let me know if it helps or if the issue is still reproduced for you.
@sergey-akhalkov Thanks for the reference, I've missed this note from the official docs.
I cannot run the application that way, it seems like it doesn't load anything. I've also tried without packager and it runs properly but because I cannot debug it in browser I'm not sure if the update has been completed properly. After running code-push deployment history TestingCodePush-iOS Staging, the last version deployed it logs No installs recorded.
Is there any other way I can try the Staging deployed application?
@kwnccc, do I get it right if you are searching the way to verify if an update has been installed or not? To achieve it you could use codePush.SyncStatus.UPDATE_INSTALLED event, also you could call and print result of execution of getUpdateMetadata method
Please let me know if you have any questions.
Most helpful comment
Had the same problem, this is what worked for me https://github.com/Microsoft/react-native-code-push/issues/875