Closed sopaco closed 8 years ago
@sopaco: CodePush has a rollback feature that protects you from bad updates - if CodePush is not called in the first run of an update, the CodePush SDK will assume that it has crashed, and undo the update the next time the app is restarted. That update will also be 'black-listed', so that it won't be applied again.
Does this make sense to you? If you run code-push deployment history <appName> <deploymentName>
from the CLI, what do you see?
As for why your app is rolling back, can you show me how you're calling CodePush?
@sopaco, did you still need help with this?
@silhouettes I am seeing the same issue. Specifically:
An update is available, but it is being ignored due to having been previously rolled back
What would cause the first sync to work and not subsequent? What do you mean by if CodePush is not called in the first run of an update
should we be calling some method in code push when the app loads?
Running into the same issue. Update runs and it downloads the new files. Restarts the app and everything is fine. But when I close the app and re-open it gives the error about it being rolled back and shows the original files. This is happening on both Android and iOS
This is similar to #696 but I will address it here in case the root cause is different.
@rt2zz, @silentcoast, are you wrapping your root component like this: https://github.com/Microsoft/react-native-code-push#plugin-usage?
To clarify - CodePush has a notifyAppReady()
function that needs to be called when an update is loaded successfully, that marks the update as 'successful'. If this is not called at some point in the first run of an update, it will be rolled back the next time the app restarts. We recommend just calling this in your componentDidMount()
. Actually, the wrapper above will just do that for you, so that you technically don't need to know about this at all.
(As an alternative, CodePush.sync()
also calls notifyAppReady()
internally, but you may not be calling sync()
on every run of your app)
Does this help?
@silhouettes I completely overlooked that section in the documentation. I added it and worked as expected.
I am still facing this issue. I have wrapped my component the way it was supposed to be wrapped. Below is my index.js file
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import codePush from "react-native-code-push";
import bgMessaging from "./src/appComponents/notification/bgMessaging";
const codePushOptions = {
checkFrequency: codePush.CheckFrequency.ON_APP_START
}
AppRegistry.registerComponent(appName, () => codePush(codePushOptions)(App));
same issue in android and working fine in ios.
This issue still persists in 7.0.4. Once an update rolled back due to some reason. Now it is not installing on the device even when we increase the targeted binary version of the app and push a fresh bundle to codepush.
For my case, I pushed a bundle without a codePush(App)
hoc.
Then after running the app, it downloads and installs the new published package which won't call codePush
on next run.
The bundle will be rolled back and disabled.
Hope it helps.
Hello @m-sayari, As you described your comment I remove the hoc implementation and check and update inside useEffect. But the issue still occur. Have you done any other implementation to resolve the issue?
Hi, so I also faced this issue but solved it in this way. What I did was, 1) Removed the codePush HOC 2) Every time, on app mount I'm checking for update and then prompting the user
The following is the code I used:
function updateApp(){
codePush.checkForUpdate()
.then(remotePackage => {
setStatus('Downloading')
return remotePackage.download()
})
.then(localPackage => {
setStatus('Installing')
return localPackage.install(codePush.InstallMode.ON_NEXT_RESTART)
})
.then(response => {
dispatch(setUpdate({
show: false,
update: null
}))
codePush.notifyAppReady()
codePush.restartApp()
})
.catch(err => {
console.log("Error while updating upackage: ", err)
})
}
The checkForUpdate() function returns null if no updates are found otherwise it will return an object with a download function. Using this download function we can get the package and then install it. After installing we need to manually call notifyAppReady() as suggested in the code Push documentation here.
What I'm doing in my app is, checking every time on mount and then if an update is available I will display a pop up asking if the user wants to install. Once the user accepts to install and clicks the button I call this function.
Hope this works!
This issue is still there, has anyone solved this? @AkashM006, your solutions work, but there is no count of rollback or installation in the app centre
@richardhuaaa
Hi @Saurabh4626, please take a look at my reply here
(android)
An update is available, but it is being ignored due to having been previously rolled back
What does that means? What's wrong? How could I reinstall the updated? It seems that I must be clear the app's data, then install it successful.