Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1715

React Native app crashes if `onFirstOpen` exists in Realm configuration

      How frequently does the bug occur?

      All the time

      Description

      I'm trying to populate my database with some initial data with onFirstOpen config, but if I'm specifying it the app crashes as soon as it called without any errors

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Yes, always

      Reproduction Steps

      createRealmContext({
          ...
          onFirstOpen: (realm) => {
            console.log("init realm?", realm.create);
            // Create default categories
            categories.forEach((r) => {
              realm.create(
                "Category",
                Category.create({
                  ...
                })
              );
            });
      
            // Create currencies
            currencies.forEach((r) => {
              realm.create(
                "Currency",
                Currency.create({
                  ...
                })
              );
            });
          },
        });
      

      Version

      10.20.0-beta.5

      What SDK flavour are you using?

      Local Database only

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      iOS 15.0

      Build environment

      Which debugger for React Native: Flipper
      Expo SDK 45

      Cocoapods version

      No response

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: