Logs showing SDK version "react-native vRealmJS/10.0.1" coming from device after upgrading to 10.1.3

I just upgraded Realm to 10.1.3 in my React Native app after encountering this error:

failed to validate upload changesets: failed to validate ArrayInsert instruction: cannot have index (1) greater than prior-size (0) (ProtocolErrorCode=212)

When testing on iOS simulators (I’ve tried 3-4 of them) and Android simulators, the requests come in with the correct SDK version in the Realm logs (e.g. ios vRealmJS/10.1.3), but when building the release version onto my device, the SDK version comes in as react-native vRealmJS/10.0.1. I tried nuking node_modules, pods, pod caches, build folders, and everything else I could think of, but still whenever I either build the app onto my device or generate an archive via Xcode, I still get this 10.0.1 version in the logs, which comes with the error mentioned above. Everything is resolved when building onto simulators, both in debug and release modes, but for some reason pushing it to the device or through app store connect doesn’t get the updated 10.1.3 version.

Would really appreciate any guidance on this - I’ve been wrestling with this error all day and somehow releasing this Realm update has ended up being the roadblock.

My best guess is that your caches haven’t been cleared, and your app is still using v10.0.1. I suggest that you clear the iOS build folder and the Metro’s cache and rebuild the entire app.

1 Like

I just tried clearing DerivedData and resetting metro cache. Same error:
failed to validate upload changesets: failed to validate ArrayInsert instruction: cannot have index (1) greater than prior-size (0) (ProtocolErrorCode=212) and SDK: react-native vRealmJS/10.0.1.
To build it I ran npx react-native run-ios --configuration Release --device. I then tried npx react-native run-ios --configuration Release (to build for simulator instead of device) and the simulator build worked perfectly fine with SDK: ios vRealmJS/10.1.3. Nothing changed between running those two builds.

We just tested this update on a different device and that one is coming in with SDK version ios vRealmJS/10.1.2. What’s interesting is that both of these incorrect versions were the first versions installed on the respective devices. Could the realm SDK version not be upgrading past the first version of realm installed on the device being used?

Hi Peter, have you tried uninstalling the old version of your app from the devices before installing the new version?

My guess is that uninstalling and reinstalling would probably fix it (I can give it a try now), but this doesn’t seem like a sustainable approach to pushing out updates, which is why I’m hoping to find the underlying cause.

Agreed - but it’s another data point.

Yep, uninstalling the app from the device and reinstalling the exact same build fixed the issue and requests are now coming in with SDK version 10.1.3.

You might have to run pod install after upgrading (and remove the iOS build folder) and rebuild your app. In order to provide hot reload, React Native is caching a lot.

I’ve tried clearing every cache and build folder I could find, and this issue persists (I also don’t have an ios/build folder (not entirely sure why), so I’m clearing the files out of DerivedData).

What makes me think this isn’t a cache issue is that after archiving and uploading the app to app store connect, I can install it on two different devices and get two different realm versions based on what those devices previously had installed, although the build is the exact same.