microsoft / react-native-code-push

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

[Question] Some of our users getting "The latest rollback info is not valid" log #2612

Closed AbdulBsit closed 9 months ago

AbdulBsit commented 1 year ago

https://github.com/microsoft/react-native-code-push/blob/df2de5e4702a07549396d75b4a3e18f58a65a6a0/CodePush.js#L253C1-L257C4

Context/Questions 1) I have release a new binary update past week, and yesterday rolled out the codepush update, now some customer are getting this The latest rollback info is not valid log, I am wondering why is this happening, as far as i can understand, we clears the pending/failed updates on new binary install, so user shouldn't be having pending/failed updates, and when they receieve OTA, they have no latest rollback/failed updates, In case rollback happened, when next time it retry, shouldUpdateBeIgnored should be returning false, as i have provided the retryOptions and the hashes should match as we have only one rollback from previous execution, but it's giving me The latest rollback info is not valid, due to mismatch of hashes, which is strange as there is only one update that is on remote and in local failed updates, so ideally hashes should match, Wondering this snippet i mentioned should return false in case of hash mismatch, and allow the update to retry 2) I have wrapped my update component in HOC provided by codepush, but that componet renders after a certian state change isSignedIn so can this be a reason of my rollbacks? should i call notifyAppReady once i receive codePush.SyncStatus.UPDATE_INSTALLED status, before the restart of app or no need to do this as this is handled by HOC?, I am handling restarting of app based on user action 3) ignoreFailedUpdates options will by pass all checks for failed updates, and will retry every time we sync, so is there any side effect for disabling ignoreFailedUpdate? Also this option is not documented, can you explain it's usage and why it's there in the first place

Code Usage

class UpdateHandler extends React.Component {
    constructor(props) {
        super(props);
    }

    codePushStatusDidChange(status) {
        switch (status) {
            case codePush.SyncStatus.CHECKING_FOR_UPDATE:
                console.log("codepush Checking for updates.");
                break;
            case codePush.SyncStatus.DOWNLOADING_PACKAGE:
                console.log("codepush Downloading package.");
                break;
            case codePush.SyncStatus.INSTALLING_UPDATE:
                console.log("codepush Installing update...");
                break;
            case codePush.SyncStatus.UP_TO_DATE:
                console.log("codepush Up-to-date.");
                break;
            case codePush.SyncStatus.UNKNOWN_ERROR: {
                console.log(
                    "🔴 Error Occurred while codepush update => ",
                    JSON.stringify(status)
                );
                break;
            }
            case codePush.SyncStatus.UPDATE_INSTALLED: {
                if (isBusy) {
                    //currently on some important task, when update comes
                    console.log(
                        "Received an update from codepush, but currently on some important task, Ignoring update alert, It will be installed on next restart"
                    );
                    return;
                }
                Alert.alert(
                    "Update Installed",
                    "Restart now to get the latest features.",
                    [
                        {
                            text: "LATER",
                            onPress: () => {
                                console.log(
                                    "Codepush update, restart later pressed by user"
                                );
                            },
                        },
                        {
                            isPreferred: true,
                            text: "RESTART NOW",
                            onPress: () => {
                                console.log(
                                    "Codepush update, restart now pressed by user"
                                );
                                codePush.restartApp();
                            },
                        },
                    ]
                );
                break;
            }
        }
    }

    codePushDownloadDidProgress(progress) {
        console.log(
            `Codepush download progress => ${parseInt(
                `${
                    parseFloat(
                        (progress.receivedBytes / progress.totalBytes).toFixed(
                            2
                        )
                    ) * 100
                }`
            )}%`
        );
    }

    render() {
        return <View />;
    }
}

export default codePush({
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_RESTART,
  mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESTART,
  rollbackRetryOptions: {
    delayInHours: 1 / 60, //retry after 1 min
    maxRetryAttempts: 5,
  },
})(UpdateHandler);
microsoft-github-policy-service[bot] commented 9 months 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.

microsoft-github-policy-service[bot] commented 9 months 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.