CodePush update not applying? Why React Native keeps the old bundle
The update downloads, but the app still runs the old JavaScript. The causes in order of likelihood (debug builds, install modes, the native bundle override, rollbacks, Hermes), with the log line that confirms each one and the fix.
If a CodePush update downloads but the app keeps running the old JavaScript, you're usually testing a debug build (which loads JavaScript from Metro), the update is optional and waiting for the next cold start, or the app rolled it back because the new bundle crashed or never confirmed it started. Check those three, in that order, before anything else. Below, every cause comes with the log line or command that confirms it, and the fix.
This post is written for CodeOnAir CodePush and @codeonair/code-push-react-native. Where Microsoft's archived react-native-code-push behaves the same way, we say so. If your app never gets offered the update at all and the log says "App is up to date", go to react-native-code-push errors: "Update is invalid" and "App is up to date" instead.
First, find out how far the update got
An update goes through three stages on a device: it's downloaded, it's installed (it runs and confirms it started), or it failed (it was rolled back). Each stage is reported to the server, so the release's numbers tell you where to look before you touch any code:
codeonair-codepush history myapp-android
The same counts are on the release in the dashboard (CodePush → Android / iOS).
| What the release shows | What it means | Go to |
|---|---|---|
| No downloads at all | The device was never offered it | The "App is up to date" post |
| Downloads go up, installs stay at 0, no failures | The update is waiting for a restart, or the native code never loads it | Causes 2 and 3 |
| Installs and failures both go up | It started, then was rolled back | Causes 4 and 5 |
Then read the device logs. The SDK's JavaScript logs start with [CodePush], and the native side logs under the CodeOnAirCodePush tag on Android and the [CodeOnAirCodePush] prefix on iOS:
# Android: JavaScript and native CodePush lines
adb logcat -s ReactNativeJS:* CodeOnAirCodePush:*
# iOS simulator: native lines
xcrun simctl spawn booted log stream --predicate 'eventMessage CONTAINS "CodeOnAirCodePush"'
On a real iPhone, open Console.app on your Mac, select the phone and filter on CodeOnAirCodePush.
1. You're testing a debug build
This catches almost everyone once. In a debug build React Native loads JavaScript from the Metro dev server, and the SDK setup keeps it that way on purpose. On iOS, the bundleURL() override only returns the CodePush bundle in the #else branch of #if DEBUG:
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
CodeOnAirCodePush.bundleURL()
#endif
}
On Android, a debug build with developer support on also loads from Metro. So a debug build can download an update and still never run it.
How to check: if you started the app with npx react-native run-android, run-ios, Xcode's default Run scheme or npx expo run:* without a release flag, it's a debug build.
Fix: test with a release build:
# React Native CLI
npx react-native run-android --mode release
npx react-native run-ios --mode Release
# Expo (prebuild)
npx expo run:android --variant release
npx expo run:ios --configuration Release
Older React Native CLIs use --variant release and --configuration Release instead of --mode. A release build installed from TestFlight or a Play testing track works too, and it's the closest thing to what users run.
2. The update is waiting for the next start
By default an optional update installs with ON_NEXT_RESTART. It downloads on this launch and runs on the next cold start. A mandatory update uses IMMEDIATE, so the app restarts as soon as the download finishes. Sending the app to the background and bringing it back is not a restart. On Android, pressing Back often doesn't end the process either.
How to check: log the sync status. UPDATE_INSTALLED with an optional release means "installed, waiting for a restart":
import CodePush from "@codeonair/code-push-react-native";
CodePush.sync(
{ installMode: CodePush.InstallMode.ON_NEXT_RESTART },
(status) => console.log("[sync]", status), // 1 = UPDATE_INSTALLED, 0 = UP_TO_DATE
);
await CodePush.getUpdateMetadata() tells you what's running now. It returns null while the binary's own bundle runs, and the update's label (such as v7) once the update has started.
Fix: to test, swipe the app away from the recent apps list and open it again. For users, choose the install mode on purpose:
- Release with
--mandatory(-m) when the fix can't wait. Mandatory updates install withIMMEDIATEunless you setmandatoryInstallMode. - Use
ON_NEXT_RESUMEto apply the update the next time the app returns from the background, withminimumBackgroundDurationso a quick app switch doesn't restart it. - Use
ON_NEXT_SUSPENDto restart while the app is in the background, so the user comes back to the new version.
Our post on CodePush install modes compares these modes. It also covers bringing users back to the same screen after a restart.
3. The native code never loads the update
If downloads go up but installs never do, even after a cold start of a release build, the native side is probably still loading the bundle that shipped inside the APK or IPA. The SDK only swaps bundles when your app asks it which file to load. Without that call, the downloaded update sits on disk and nothing runs it. Later update checks then report "up to date", because the device already has that update waiting.
How to check: look for the override in your native code.
Android, when MainApplication builds the host with getDefaultReactHost (newer templates):
import com.codeonair.codepush.CodeOnAirCodePush
getDefaultReactHost(
context = applicationContext,
packageList = PackageList(this).packages,
jsBundleFilePath = CodeOnAirCodePush.getJSBundleFile(applicationContext),
)
Android, React Native 0.70 to 0.76 (DefaultReactNativeHost), for both architectures:
override fun getJSBundleFile(): String? = CodeOnAirCodePush.getJSBundleFile(applicationContext)
iOS needs the bundleURL() override shown in cause 1, or [CodeOnAirCodePush bundleURL] in an Objective-C AppDelegate.mm.
Fix: add the override and ship one store build. This is native code, so no over-the-air update can fix it. If you use Expo prebuild, a --clean prebuild regenerates MainApplication and AppDelegate, so apply the change again (or keep it in a config plugin of your own) and check the generated files before every store build.
4. The update was rolled back
Every update has to confirm that it started. CodePush.sync() does that as its first step (and so does the codePush(App) wrapper), or you can call CodePush.notifyAppReady() yourself. If the app restarts before that call, because the bundle crashed or hung or the call never ran, the next launch goes back to the previous bundle. The SDK reports the failure to the dashboard and skips that release on that device from then on.
How to check: the native log says so on the launch that rolls back:
W CodeOnAirCodePush: Update 3f9c…e1 didn't call notifyAppReady — rolling back
(the long value is the update's package hash), and later syncs log skipping v7: it was rolled back on this device. With Microsoft's SDK the line is Update did not finish loading the last time, rolling back to a previous version.
Look for these causes, roughly in this order:
- The new JavaScript needs native code the binary doesn't have. A new native module, or a library upgrade that changed its native side, crashes at startup with errors such as
TurboModuleRegistry.getEnforcing(...): 'RNFoo' could not be foundorInvariant Violation. CodePush can only change JavaScript and assets. Ship native changes through the store and target the update at that new version. sync()ornotifyAppReady()runs too late. If the call sits behind a login screen, a splash animation that waits on the network, or a screen most users never open, a user who closes the app first triggers a rollback even though nothing crashed. Callsync()in your root component, once, on every launch.- A plain JavaScript error at startup. Run the same commit as a release build locally. Most startup crashes show up straight away in
adb logcator the Xcode console.
Fix: fix the cause and release again. A new release has a new label and hash, so devices that rolled back the old one will try it. ignoreFailedUpdates: false makes a device retry a rolled-back release, but use it for testing only. In production it would just crash again. To get everyone off a bad release at once, run codeonair-codepush rollback myapp-android. It publishes the previous bundle as a new release, so devices move back too.
5. The bundle was built for a different binary
Even a JavaScript-only change can fail if the bundle was built from different tooling than the binary on the phone.
- Hermes bytecode from another React Native version.
release-reactcompiles Hermes bytecode with thehermescin your project'snode_modules. If you release from a branch whose React Native version differs from the store build, the bytecode version may not match the Hermes engine inside the app, and the bundle fails at startup and is rolled back. Release from the same React Native version the binary was built with. - Hermes detection overridden by hand.
--useHermes falsefor an app that uses Hermes (or the reverse) gives you a bundle the app wasn't built to run. Leave the flag out unless detection is wrong. - A zip without a React Native bundle. The SDK looks for
index.android.bundleormain.jsbundleinside the update. Releasing an app folder withcodeonair-codepush releaseinstead ofrelease-reactfails at download withThe update has no index.android.bundle(ormain.jsbundleon iOS). Thereleasecommand is for folders of content used by the native content SDKs, not for React Native apps.
6. A new store build replaced the update
When a user installs a new version of the app from the store (a different versionName on Android, a different CFBundleShortVersionString on iOS), the SDK drops updates made for the old version and runs the new binary's own bundle. That's deliberate, because the store build is newer than any update made for the old one. If the old version's update seems to "disappear", that's why.
Fix: release the update again for the new binary version with -t 1.5.0, or use a range such as -t 1.5.x if it suits every 1.5 build.
A two-minute checklist
- Release build, not debug (or Metro).
- App fully closed and reopened after the download (optional updates).
-
MainApplicationpassesCodeOnAirCodePush.getJSBundleFile(...), andAppDelegatereturnsCodeOnAirCodePush.bundleURL()outside#if DEBUG. -
CodePush.sync()runs once on every launch, in the root component, before any login gate. - No new native modules or native library changes since the store build.
- Released from the same React Native version as the binary.
- Released with
release-react, notrelease. -
codeonair-codepush historyshows installs, not only downloads or failures.
FAQ
Why does my CodePush update only show after I restart the app twice?
The first launch checks for the update and downloads it. With the default ON_NEXT_RESTART mode it runs on the next cold start, which is the second launch. Release it as mandatory, or use ON_NEXT_RESUME, if it has to apply sooner.
Does CodePush work in debug builds?
No. Debug builds load JavaScript from Metro, so updates don't run there. Test with a release build, or one from TestFlight or a Play testing track.
How do I make an update apply immediately?
Release it with --mandatory. Mandatory updates install with IMMEDIATE by default, so the app restarts as soon as the download finishes. In a custom flow, CodePush.restartApp(true) restarts only if an update is waiting.
Why did my CodePush update roll back?
The app restarted before the update confirmed it started. Either the bundle crashed (often because it needs a native module the binary doesn't have), or sync() / notifyAppReady() ran too late. The device log line didn't call notifyAppReady — rolling back confirms it.
Can a CodePush update add a native module or change permissions?
No. Native code, permissions, the app icon and Info.plist or AndroidManifest.xml changes need a store release. CodePush changes JavaScript and assets only.
Ship updates you can see land
CodeOnAir CodePush shows downloads, installs and rollbacks for every release, with staged rollouts (-r 20) and one-command rollback. The setup steps are in the CodePush project setup docs and the CodePush FAQs. Moving from App Center? The migration guide covers the SDK swap and CI. On React Native 0.76 or later, see react-native-code-push and the New Architecture. The Free plan includes 5,000 update downloads a month: create a free account, or see pricing.
Checked on 15 November 2026 against the @codeonair/code-push-react-native source on npm, the @codeonair/code-push-cli README, and the archived microsoft/react-native-code-push source for its log messages.