Realm-js: Crash on iOS 14.5 beta: Attempting to change configurable attribute of unconfigurable property

Created on 4 Feb 2021  路  23Comments  路  Source: realm/realm-js

Expected Results

Not to crash.

Actual Results

Crashed on iOS 14.5 beta. All other iOS versions are fine.

If we don't use Realm in JS, then everything is fine. But if we add one line to import Realm:

import Realm from 'realm';

It crashed with the following error: Attempting to change configurable attribute of unconfigurable property.

And crashed when running the following Object.defineProperties() in lib/extensions.js of realm-js:

Object.defineProperties(realmConstructor, getOwnPropertyDescriptors({
    _extendQueryBasedSchema(schema) {
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Class);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Permission);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Realm);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Role);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.User);
        addSchemaIfNeeded(schema, realmConstructor.Subscription.ResultSets);
    },

    // Creates the user agent description for the JS binding itself. Users must specify the application
    // user agent using Realm.Sync.setUserAgent(...)
    _createUserAgentDescription() {
        // Detect if in ReactNative (running on a phone) or in a Node.js environment
        // Credit: https://stackoverflow.com/questions/39468022/how-do-i-know-if-my-code-is-running-as-react-native
        try {
            var userAgent = "RealmJS/";
            userAgent = userAgent + require('../package.json').version + " (" + context + ", ";
            if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
                // Running on ReactNative
                const Platform = require('react-native').Platform;
                userAgent += Platform.OS + ", v" + Platform.Version;
            } else {
                // Running on a normal machine
                userAgent += process.version;
            }
            return userAgent += ")";
        } catch (e) {
            return "RealmJS/Unknown"
        }
    },
}));

Maybe due to some change in iOS 14.5 JavaScript core?

Simulator Screen Shot - iPhone 8 - 2021-02-04 at 17 03 48

Steps to Reproduce

1.Setup a RN project and import realm-js
2.Run the App on iOS 14.5 beta.

Not sure whether it's related to my RN version (0.59). But it all worked fine until the recently released iOS 14.5 beta.
Tried Relam JS 5.0.5 and 6.1.5, both has the same issue.

Code Sample

import Realm from 'realm';

Version of Realm and Tooling

  • Realm JS SDK Version: 5.0.5 and 6.1.5
  • Node or React Native: RN 0.59.10
  • Client OS & Version: iOS 14.5 beta
  • Which debugger for React Native: None
O-Community

Most helpful comment

@kneth is there any update on this? We don't want our live app to crash when iOS 14.5 releases.

All 23 comments

We are also experiencing this same issue relating to iOS 14.5 beta.

Version of Realm and Tooling

Realm JS SDK Version: 3.6.3 & 6.1.5
Node or React Native: RN 0.63.4
Client OS & Version: iOS 14.5 beta
Which debugger for React Native: _None_

Thank you for bringing it to our attention. It looks like a change in iOS 14.5 beta which we have to handle. We need to investigate it (run our tests on iOS 14.5 beta).

The latest Xcode/iOS beta seem to bring some issues that we need to sort out.

Thanks @kneth can you provide a rough ETA?

@kneth is there any update on this? We don't want our live app to crash when iOS 14.5 releases.

Upgrading to latest version of Realm seems to fix the problem. Can anyone else also confirm this?

Upgrading to latest version of Realm seems to fix the problem. Can anyone else also confirm this?

Realm 6 or Realm 10 ? 馃憖

Upgrading to latest version of Realm seems to fix the problem. Can anyone else also confirm this?

Realm 6 or Realm 10 ? 馃憖

We upgraded from 6 to 10

Hi @Hannes-Endare, does the upgrading fix this crash? We have same crash happens on the iOS 14.5 beta and are looking forward to fixing this before the iOS 14.5 formal version release.

We upgraded realm js to v10.2.0 from 3.6.3, initial testing shows this fixed the issue, the app no longer crashes on iOS 14.5 beta.

I tried to upgrade realm from v3.2.0 to v10.2.0, but always failed with "missing realm constructor", I searched the related issues and tried all the solutions but still failed with missing realm constructor. The error message is useless, of course we did pod install, RN version is 0.61.5, really upset about this.

@lakhman @Hannes-Endare Could you please help with this? What are your migration steps?

@mrarronz We didn't have any issues upgrading, install realm version 10.2.0, pod install inside ios directory, open xcode - clear all build cache - rebuild, worked first time without any issues.
_Note:_ we are not using any "realm cloud/sync" functionality - we only use the realm database to store app data.

@mrarronz make sure you initialise Realm in the correct way. I'm not familiar with 3.2.0 but maybe they changed something in init phase?

@kneth Do you have any rough estimation when Realm 6 is going to be patched? 馃槃

Is it going to take days, weeks, or months?

This issue also appears to have been crashing our app on 14.5 beta. Upgrading to 10.2.0 from 6.x.x was painless and appears to have fixed the crash

Is it going to take days, weeks, or months?

@Frans-L without promising anything specific, this should be a matter of days.

@Frans-L v6.1.6 has been released.
Appreciate any feedback on the fix, and/or other problems encountered with the new xcode/ios beta.

@steffenagger, Great work getting out a hotfix that quick. I was wondering if this change would apply for older major versions (ie. v2.92)?

@justindi15 Thank you, and ugh - you're referencing a version that pre-dates my time in Realm :)

In general v6 is being maintained while new features goes towards v10 (using realm without sync, v6 & v10 is basically the same, with v10 seeing active developerment, so my recommendation here would be v10).

May I flip the question around and ask: what's keeping you from updating?

FYI that this issue is potentially resolved in ios 14.5 beta 2

FYI that this issue is potentially resolved in ios 14.5 beta 2

@bsk26 can you share where you've got this information? The update to WebKit (in beta 1) now handles redefining properties correctly, in regards to the configurable option.

FYI that this issue is potentially resolved in ios 14.5 beta 2

@bsk26 can you share where you've got this information? The update to WebKit (in beta 1) now handles redefining properties correctly, in regards to the configurable option.

This is just from our testing, unfortunately you have more formal information than I do here. The app was crashing on 14.5 beta, I'm fairly certain due to this issue, and doesn't seem to be on the latest beta release.

That's super interesting findings! Weird, but thanks for sharing @bsk26 馃憤
Maybe the update broke a few _too_ many existing implementations.

We'll at least have it on our radar going forward.

Was this page helpful?
0 / 5 - 0 ratings