React-native-code-push: Can you change deployment keys and thus code push package with the same app build?

Created on 4 Apr 2018  路  6Comments  路  Source: microsoft/react-native-code-push

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

  1. Call codePush.sync(deploymentKey: x, codePush.InstallMode.IMMEDIATE) from a button within the app. App does nothing.
  2. Call codePush.sync(deploymentKey: y, codePush.InstallMode.IMMEDIATE) from another button within the app. App does nothing.

Expected Behavior

What you expected to happen?
I expect the app to restart and apply a new code push package based on the different deployment key.

Actual Behavior

What actually happens?

Nothing happens on the ui.
  STACK TRACE AND/OR SCREENSHOTS
logs:
An update is available, but it is being ignored due to having been previously rolled back

Environment

  • react-native-code-push version:5.1.3-beta
  • react-native version:0.53.0
  • iOS/Android/Windows version: tested on ios 11
  • Does this reproduce on a debug build or release build? both
  • Does this reproduce on a simulator, or only on a physical device? only tested on device

(The more info the faster we will be able to address it!)

iOS investigating

Most helpful comment

I have noticed that calling sync to change deployment from Production to Staging will not install the staging build if CodePush determines that the current (production) bundle is up-to-date. We had to write native code which calls CodePush.clearUpdates() before calling sync so that the requested bundle would be downloaded. I have been meaning to spend more time to debug this situation to see exactly what is happening inside CodePush internals. I cannot confirm exactly what the issue is, but I have seen cases where using sync() to change from Production->Staging (and back) does not always work.

All 6 comments

Hi @Catpants
Please see example usage of SyncOptions.
Shortly, in your case:

codePush.sync({ 
   deploymentKey: "KEY", 
   installMode: codePush.InstallMode.IMMEDIATE
});

Thanks!

@iTOYS I apologise, my original code example was not accurate. I am indeed calling it like this:
codePush.sync(
{ installMode: codePush.InstallMode.IMMEDIATE, deploymentKey: Config.CODEPUSH_KEY_IOS }
)
I still have the issue where code push is rolling back and not syncing on demand with two different keys. I would like to know, is it even possible to do this?

I have noticed that calling sync to change deployment from Production to Staging will not install the staging build if CodePush determines that the current (production) bundle is up-to-date. We had to write native code which calls CodePush.clearUpdates() before calling sync so that the requested bundle would be downloaded. I have been meaning to spend more time to debug this situation to see exactly what is happening inside CodePush internals. I cannot confirm exactly what the issue is, but I have seen cases where using sync() to change from Production->Staging (and back) does not always work.

@Catpants
I've checked again with this config:

let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
export default App = codePush(codePushOptions)(App);

and with this sync call:

const Staging = "key_staging";
const Production = "key_production";
...
<TouchableOpacity
  style = {{height: 70, width: 200, backgroundColor: 'green'}}
  onPress={() => {
     codePush.sync({
          deploymentKey: Production, 
          updateDialog: true,
          installMode: codePush.InstallMode.IMMEDIATE
      },
      this.codePushStatusDidChange,
      this.codePushDownloadDidProgress);
  }}>
  <Text>Current version: 68(S)</Text> 
</TouchableOpacity>
...

So I haven't faced any issue.

Could you please describe your flow?

Thanks!

Hi @Catpants,
I am going to close this issue for now, but please feel free to reopen it if you still have any questions.

i can`t update the app after changing the deploy key remotely plz help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevando picture kevando  路  4Comments

quanzaiyu picture quanzaiyu  路  3Comments

cgerikj picture cgerikj  路  3Comments

djw27 picture djw27  路  3Comments

fanzhiri picture fanzhiri  路  3Comments