Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):
code-pushI expect working releases to stay in the app
It rolls back to original bundle after re-launch
First log after app is launched and it downloads the new release:
[CodePush] Applying full update.
[CodePush] Loading JS bundle from file:///Users/esben/Library/Developer/CoreSimulator/Devices/2B573718-ABC2-43C2-8654-3F2057D3BD55/data/Containers/Data/Application/54CD338B-605E-43B0-85CA-B96395A8B33E/Library/Application%20Support/CodePush/8e227e913597289f777e93f5e1bf24dd53462233460100695d91bda7b2f9462f/CodePush/main.jsbundle
2019-07-30 16:46:12.374108+0200 LoudstandApp[31412:3944134] Task <31C1E632-173E-4F82-A4B3-A17E78C19692>.<2> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://codepush.azurewebsites.net/reportStatus/download, NSErrorFailingURLKey=https://codepush.azurewebsites.net/reportStatus/download, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <31C1E632-173E-4F82-A4B3-A17E78C19692>.<2>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <31C1E632-173E-4F82-A4B3-A17E78C19692>.<2>, NSLocalizedDescription=cancelled} [-999]
Here's my AppDelegate.m
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}
I use react-native-navigation in the project, so I am not wrapping with the CodePush HOC, but doing this:
```ts
const codePushOptions = {
installMode: CodePush.InstallMode.ON_NEXT_RESUME,
checkFrequency: CodePush.CheckFrequency.ON_APP_RESUME,
}
export async function startApp() {
CodePush.sync(codePushOptions) // Not awaiting here - that cause an app start delay
Navigation.events().registerAppLaunchedListener(async () => {
persistStore(store, {}, async () => {
Navigation.setDefaultOptions({
layout: { orientation: ['portrait'] },
})
registerScreens(store)
await showAwaitAuthScreen()
})
})
})
}
```
(The more info the faster we will be able to address it!)
Tried running in debug mode, commenting out the DEBUG compiler statement...
As you can see, it reports succes installing v2, although I also get some 403 errors from the codepush REST API?
2019-07-30 17:26:28.462 [info][tid:com.facebook.react.JavaScript] [CodePush] Checking for update.
2019-07-30 17:26:28.462428+0200 LoudstandApp[33948:4002226] [CodePush] Checking for update.
2019-07-30 17:26:34.993 [info][tid:com.facebook.react.JavaScript] [CodePush] Downloading package.
2019-07-30 17:26:34.993186+0200 LoudstandApp[33948:4002226] [CodePush] Downloading package.
2019-07-30 17:26:36.194 [warn][tid:com.facebook.react.CodePushQueue][RCTEventEmitter.m:53] Sending `CodePushDownloadProgress` with no listeners registered.
2019-07-30 17:26:36.193843+0200 LoudstandApp[33948:4002198] Sending `CodePushDownloadProgress` with no listeners registered.
[CodePush] Applying full update.
2019-07-30 17:26:37.699 [info][tid:com.facebook.react.JavaScript] [CodePush] Installing update.
2019-07-30 17:26:37.698758+0200 LoudstandApp[33948:4002226] [CodePush] Installing update.
2019-07-30 17:26:37.703 [info][tid:com.facebook.react.JavaScript] [CodePush] Restarting app
2019-07-30 17:26:37.703395+0200 LoudstandApp[33948:4002226] [CodePush] Restarting app
2019-07-30 17:26:37.712055+0200 LoudstandApp[33948:4002492] Task <FE02FAC7-BB40-40EC-B9AB-37219EBDB221>.<7> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://codepush.azurewebsites.net/reportStatus/download, NSErrorFailingURLKey=https://codepush.azurewebsites.net/reportStatus/download, _NSURLErrorRelatedURLSessionTaskErrorKey=(
2019-07-30 17:26:38.486 [info][tid:com.facebook.react.JavaScript] [CodePush] Checking for update.
2019-07-30 17:26:38.485949+0200 LoudstandApp[33948:4002516] [CodePush] Checking for update.
2019-07-30 17:26:38.522 [info][tid:com.facebook.react.JavaScript] [CodePush] Reporting CodePush update success (v2)
2019-07-30 17:26:38.522282+0200 LoudstandApp[33948:4002516] [CodePush] Reporting CodePush update success (v2)
2019-07-30 17:26:39.250 [info][tid:com.facebook.react.JavaScript] [CodePush] Report status failed: {"package":{"deploymentKey":"....","description":"debug.new2","failedInstall":false,"label":"v2","isMandatory":true,"isPending":false,"bundlePath":"CodePush/main.jsbundle","downloadUrl":"https://codepushupdates.azureedge.net/storagev2/wLi01ppiv3ooe3OTaC0bXH83mLnPb745246f-4fff-4e59-9b2b-5d72f7085b50","packageHash":"6ea86e00d339a0503a869a2a53749ebf35df2e044415df81524a66d5b9eed4c0","appVersion":"1.0","packageSize":2771668},"status":"DeploymentSucceeded"}
2019-07-30 17:26:39.249663+0200 LoudstandApp[33948:4002516] [CodePush] Report status failed: {"package":{"deploymentKey":"....","description":"debug.new2","failedInstall":false,"label":"v2","isMandatory":true,"isPending":false,"bundlePath":"CodePush/main.jsbundle","downloadUrl":"https://codepushupdates.azureedge.net/storagev2/wLi01ppiv3ooe3OTaC0bXH83mLnPb745246f-4fff-4e59-9b2b-5d72f7085b50","packageHash":"6ea86e00d339a0503a869a2a53749ebf35df2e044415df81524a66d5b9eed4c0","appVersion":"1.0","packageSize":2771668},"status":"DeploymentSucceeded"}
2019-07-30 17:26:39.769 [info][tid:com.facebook.react.JavaScript] [CodePush] An unknown error occurred.
2019-07-30 17:26:39.769031+0200 LoudstandApp[33948:4002516] [CodePush] An unknown error occurred.
2019-07-30 17:26:39.769 [info][tid:com.facebook.react.JavaScript] [CodePush] 403:
2019-07-30 17:26:39.769278+0200 LoudstandApp[33948:4002516] [CodePush] 403:
Just a heads up, your codepush deployment key is disclosed in the last log you posted. It is probably a good idea to revoke it and create a new one to avoid misuse.
Hopefully someone else can shed som light on your actual problem :)
Same issue here. It asks to update the app, after approving it successfully updates the app. But when I restart the app, it rollbacked to the previous version. I'm not sure if it's required with the sync method, but did you also call notifyApplicationReady? @esbenvb I've also asked this question on Stackoverflow.
I'm also seeing this issue. The app receives the codepush fine while it is open, but after closing and re opening the app it is reverting back to the original bundle. We are also displaying the label from codePush.getUpdateMetadata() in the app and that is not reset, even when the js bundle is reset.
Our app is wrapped like this:
const AppWithCodePush = codePush({
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_RESUME,
})(App)
export default App
we are not calling codePush.sync() but we are calling notifyApplicationReady() in componentDidMount()
We have the following lines in AppDelegate.m
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}
I see some logs that look like this:
[CodePush] Applying diff update.
[CodePush] Verifying hash for folder path <path>
...
[CodePush] The update contents succeeded the data integrity check.
[CodePush] Loading JS bundle from <path to file>
[C33 codepush.azurewebsites.net:443 tcp, url hash: 16179b0e, tls] cancel
[C33 codepush.azurewebsites.net:443 tcp, url hash: 16179b0e, tls] cancelled
...
I ran into this problem and found a solution for our case. When we encountered the problem, we were only running codePush.sync() if there was an update:
codePush.checkForUpdate(deploymentKey).then((update) => {
if (update) {
if (!update.failedInstall) {
codePush.sync({
...
When I added sync to the condition where update was undefined, the update was persisted as expected.
Hope this helps.
I've been calling the sync() without any conditions in both the original build and in the subsequent bundles but still experience that iOS rolls back to the previous build after running the new build once.
On 24 Aug 2019, at 18.22, Robert Dickert notifications@github.com wrote:
I ran into this problem and found a solution for our case. When we encountered the problem, we were only running codePush.sync() if there was an update:
codePush.checkForUpdate(deploymentKey).then((update) => {
if (update) {
if (!update.failedInstall) {
codePush.sync({
...
When I added sync to the condition where update was undefined, the update was persisted as expected.Hope this helps!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I was running into the same issue with CodePush + React Native Navigation - it kept rolling back after a successful install. Turned out I missed something in my AppDelegate.m.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...
// START NECESSARY CODE
// Make sure this matches what is in sourceURLForBridge
NSURL *jsCodeLocation;
#if DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [CodePush bundleURL];
#endif
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
// END NECESSARY CODE
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}
Basically when the app was running and I got the update we used the bundle from sourceURLForBridge. When the app launched though React Native Navigation was starting the app with the result of [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];, which is still the code the app was bundled with. The fix for me was to point the jsCodeLocation in didFinishLaunchingWithOptions to the CodePush bundle.
In my particular case it was definitely developer error: The DEBUG flag was set to true in our staging build so it was always getting the bundle from [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; rather than from [CodePush bundleURL];
@spencercarli Thanks! you saved my day - this solved my iOS issue.
@spencercarli You are a legend. Thank you.
Most helpful comment
I was running into the same issue with CodePush + React Native Navigation - it kept rolling back after a successful install. Turned out I missed something in my AppDelegate.m.
Basically when the app was running and I got the update we used the bundle from
sourceURLForBridge. When the app launched though React Native Navigation was starting the app with the result of[[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];, which is still the code the app was bundled with. The fix for me was to point thejsCodeLocationindidFinishLaunchingWithOptionsto the CodePush bundle.