r/reactnative • • 3d ago

Question React Native OTA updates: best practices for shipping safely

https://bitrise.io/blog/post/react-native-ota-updates-best-practices

I work at Bitrise and we wrote this up for our blog, so there's a mention of our CodePush service at the end. One of our engineers wrote up how he ships OTA updates without breaking prod. It covers version targeting, like capping every range (>=2.0.0 <=2.2.25) so an update can't land on a future build you never tested it against. It also gets into install behaviour, staged rollouts, and why you should think twice before rolling back a DB schema change.

Curious which best practices we've missed, or what you'd add from your own releases.

6 Upvotes

8 comments sorted by

1

u/East_Eye_2997 2d ago

Are code pushes the full js bundle or are they delta updates? For example if an apps js bundle is 100mb and a 1 line change would be insane to get 1m ppl to download 100mb for it

1

u/ZMech 2d ago edited 2d ago

Pretty much all ota tools do delta updates.

But, but most of them (I think including bitrise) can only do a delta from follow up updates. The first one after a store release will be a full bundle.

1

u/Western_Cap_6934 2d ago

That first-update rule is not universal. Expo Update can patch from the store build's embedded bundle when that bundle has been uploaded. Patches can still fall back to a full bundle, so a one-line change does not guarantee a tiny download for every device. Bitrise may have different constraints.

1

u/ZMech 2d ago

Whoops, there was a missing "most". I didn't know that about Expo though, that's useful to know.

1

u/ofalvai 1d ago

(Oliver from Bitrise here, working on the CodePush SDK)

That's correct, at the moment Bitrise only builds deltas against an earlier CodePush update, and the first CodePush update is a full download. We are working on a tighter integration between CI/CD and CodePush though, and it's going to allow us to build deltas against your store releases as well. We just need to figure out some interesting edge cases first.

Also, we recently shipped binary diffing, which makes delta updates even smaller in most cases. It's behind an opt-in feature flag for now, but plan to make it the default soon.

3

u/anthony-ball 2d ago

One thing I'd add: tie the runtime version to a fingerprint of the native side (expo-updates has a fingerprint policy for this) instead of a hand-bumped app version. That way an update can't land on a binary whose native modules don't match, which is the OTA failure that actually hurts. For anything that moves money, I'd also keep those flows behind a remote flag, since a kill switch takes effect faster than a rollback reaches everyone's device.

1

u/hedanio 51m ago

or just yolo it