microsoft / react-native-code-push

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

CodePush rollbacks after updating #2020

Closed sh-muzzammil closed 2 years ago

sh-muzzammil commented 3 years ago

Hello Guys , I am also facing the React Native app center CodePush issue on iOS.

When i send a CodePush via appcenter on my React Native app.It do receive the update and updates the app successfully , however when i kill the app from the background and start it over again the app is in the previous state ( before updation). The updates are not getting saved

Unfortunately nothing has worked

This is my App.js

/**

Sample React Native App https://github.com/facebook/react-native @Format @flow strict-local */ import {useEffect, useState} from 'react'; import React from 'react'; import Container from './App/Navigation/Container/Container'; import codePush from 'react-native-code-push'; import {View, Text} from 'react-native'; // let codePushOptions = {checkFrequency: codePush.CheckFrequency.ON_APP_RESUME};

const codePushOptions = { updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE, checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, };

import {initializeLanguage} from './App/locales/index';

const App = () => { // Bootstrap(); [isLoaded, setIsLoaded] = useState(false); useEffect(() => { initializeLanguage().then((response) => { setIsLoaded(response); }); }, []);

codePush.sync({ updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE, });

if (isLoaded) { return ; } else { return (

Loading...!

); } };

export default codePush(codePushOptions)(App);

douglasndm commented 3 years ago

I'm having the same problem with react native 0.63.4 and code push 7.0

JacquesLeupin commented 3 years ago

I seem to be having the same problem:

"react-native-code-push": "^6.4.1", "react-native": "0.63.4",

In the top-level index.js of our app:

const codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
AppRegistry.registerComponent(appName, () => codePush(codePushOptions)(App))

In our sync func on loading screen:

  async function wrapperFunc() {
    try {
      await codePush.sync(
        { installMode: codePush.InstallMode.IMMEDIATE },
        (status) => {
          switch (status) {
            case codePush.SyncStatus.DOWNLOADING_PACKAGE:
              setDownloading(true);
              alertMsg();
              break;
            case codePush.SyncStatus.UP_TO_DATE:
            default:
              break;
          }
        },
        codePushDownloadDidProgress
      );
    } catch (e) {
      console.error(e);
    }
    await redirectView();
  }

Codepush is working as expected on Android, but our iOS app will only receive codepush updates once: upon 1st app restart. Upon subsequent app restarts, our iOS app seems to not receive updates.

I peeked through #1904 (which seems to describe the same problem), but none of the outlined solutions work for our app.

tdoran commented 3 years ago

I'm experiencing the same - iOS only. react-native: 0.63.2 react-native-code-push: 6.2.0

This thread seems to be the same issue. There are some workarounds/solutions there, but have yet to test them myself

MOwais commented 3 years ago

I am experiencing the same but for Android. Where can we see the logs for automatic rollbacks? The documentation mentions

"Rollbacks - The number of times that this release has been automatically rolled back on the client. Ideally this number should be zero, and in that case, this metric isn't even shown. However, if you released an update that includes a crash as part of the installation process, the CodePush plugin will roll the end user back to the previous release, and report that issue back to the server.... " The issue is reported back to the server... How/where can I access this?

"react-native": "0.61.5",
"react-native-code-push": "^6.2.1",
ghost commented 2 years ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

jiaxiangcheng commented 2 years ago

I'm experiencing the same - iOS only. react-native: 0.63.2 react-native-code-push: 6.2.0

This thread seems to be the same issue. There are some workarounds/solutions there, but have yet to test them myself

Did you solve the issue?

jiaxiangcheng commented 2 years ago

Hello Guys , I am also facing the React Native app center CodePush issue on iOS.

When i send a CodePush via appcenter on my React Native app.It do receive the update and updates the app successfully , however when i kill the app from the background and start it over again the app is in the previous state ( before updation). The updates are not getting saved

Unfortunately nothing has worked

This is my App.js

/**

Sample React Native App https://github.com/facebook/react-native @Format @flow strict-local */ import {useEffect, useState} from 'react'; import React from 'react'; import Container from './App/Navigation/Container/Container'; import codePush from 'react-native-code-push'; import {View, Text} from 'react-native'; // let codePushOptions = {checkFrequency: codePush.CheckFrequency.ON_APP_RESUME};

const codePushOptions = { updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE, checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, };

import {initializeLanguage} from './App/locales/index';

const App = () => { // Bootstrap(); [isLoaded, setIsLoaded] = useState(false); useEffect(() => { initializeLanguage().then((response) => { setIsLoaded(response); }); }, []);

codePush.sync({ updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE, });

if (isLoaded) { return ; } else { return (

Loading...!

); } };

export default codePush(codePushOptions)(App);

Did you find the solution for iOS to not roll back after restart?

ghost commented 2 years ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

ZaharGusyatin commented 2 years ago

any updates?

shllg commented 2 years ago

We recently tried to integrate CodePush into our app. Unfortunately, it does not work. The error messages don't provide directions for changes anymore. We tried different versions, update strategies and ways how to toggle the update.

CodePush detects updates correctly. It downloads the files. After restart, the iOS log will always say

[CodePush] Update did not finish loading the last time, rolling back to a previous version

We don't know how to continue here. Is there any chance to get more insights into the reasons for a rollback?

shllg commented 2 years ago

I patched the code (in fact, I removed a part). Now, the codepush runs on iOS:

The original function causing the "issue" is initializeUpdateAfterRestart:

https://github.com/microsoft/react-native-code-push/blob/master/ios/CodePush/CodePush.m#L393

It checks the pending update for a updateIsLoading is loaded flag. This flag will always be false which results in a general rollback - no matter what.

I changed the code to always accept the update at this point:

- (void)initializeUpdateAfterRestart
{
#ifdef DEBUG
    [self clearDebugUpdates];
#endif
    self.paused = YES;
    NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
    NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
    if (pendingUpdate) {
        _isFirstRunAfterUpdate = YES;

        // Mark that we tried to initialize the new update, so that if it crashes,
        // we will know that we need to rollback when the app next starts.
        [self savePendingUpdate:pendingUpdate[PendingUpdateHashKey]
                      isLoading:YES];
    }
}

I won't create a PR for that since obviously there is a reason for the check. Can we get some input from the maintainers regarding this?

francois-pasquier commented 2 years ago

I fixed this issue by reinstalling a react native project, adding codepush and adding every libraries one by one until I was sure everything was working fine.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

ghost commented 2 years ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.

nguyenvanquan7826 commented 2 years ago

I same error. When run debug, it not crash. But in release, when my app start, it crash and in app center manager, it show rollback. After it not crash again but also do not try to update again.

ahmadzraiq commented 2 years ago

Any update?

ammarkdn commented 2 years ago

any updates?

santoshvarma4u commented 1 year ago

any update ?

SutharRohit commented 1 year ago

Hi,

I am getting the same issue in iOS only, but for the android it is working fine.

i am using:

"react-native": "0.66.4",
"react-native-code-push": "^7.1.0",

tried all the above solutions, but did not get success.

amanthegreatone commented 1 year ago

been struggling with this issue also for a while now

alimomos commented 1 year ago

any update?

vision-llz commented 1 year ago

Same problem, only happens on ios

baixjian commented 1 year ago

同样的问题,只发生在ios上

同样的问题,只发生在ios上

privatepej commented 11 months ago

any update?

a2zcreatorzTeam commented 7 months ago

any update?

ritik1576 commented 7 months ago

same issue in android , react native version - 0.64 and code push - 7.0.4

Saurabh4626 commented 4 months ago

any update?

Bruce-Ming commented 4 months ago

same issue,i update react native from 0.67 to 0.72 "react": "18.2.0", "react-native": "0.72.4", "react-native-code-push": "^8.1.0",

DordeDimitrijev commented 4 months ago

Hi @Bruce-Ming tnx for reaching out, could you please try using any of the 0.71.x react-native versions and see if this issue still occurs.

RobinChiHsu commented 3 months ago

image I changed my Podfile then it works.