microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

what it means? `An update is available, but it is being ignored due to having been previously rolled back` #524

Closed sopaco closed 8 years ago

sopaco commented 8 years ago

(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.

richardhuaaa commented 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?

richardhuaaa commented 8 years ago

@sopaco, did you still need help with this?

rt2zz commented 7 years ago

@silhouettes I am seeing the same issue. Specifically:

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?

ghost commented 7 years ago

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

richardhuaaa commented 7 years ago

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?

ghost commented 7 years ago

@silhouettes I completely overlooked that section in the documentation. I added it and worked as expected.

tarun29061990 commented 5 years ago

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));
rmamtaventures commented 5 years ago

same issue in android and working fine in ios.

Kunal-Airtel2022 commented 2 years ago

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.

m-sayari commented 1 year ago

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.

guvenkaranfil commented 1 year ago

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?

AkashM006 commented 1 year ago

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!

Saurabh4626 commented 4 months ago

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

DordeDimitrijev commented 4 months ago

Hi @Saurabh4626, please take a look at my reply here