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

Upgrading @realm/react from 0.7.0 to 0.8.0+ breaks app

      How frequently does the bug occur?

      Always

      Description

      Unable to keep the app running, the realm keeps getting closed for no reason

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      Error: Cannot access realm that has been closed.
      

      Can you reproduce the bug?

      Always

      Reproduction Steps

      This is how the provider is initialized:

      import { RealmProvider as Provider } from "@realm/react";
      import { Buffer } from "buffer";
      import { PropsWithChildren, useContext } from "react";
      import Spinner from "../components/Spinner";
      import { schemas } from "../lib/store/db/realm";
      import { EncryptionKeyContext } from "./SessionProvider";
      
      export default function RealmProvider({ children }: PropsWithChildren) {
        const encryptionKeys = useContext(EncryptionKeyContext);
      
        if (!encryptionKeys.realmKey) {
          return <Spinner />;
        }
      
        return (
          <Provider
            schema={schemas}
            schemaVersion={5}
            encryptionKey={Buffer.from(encryptionKeys.realmKey, "base64")}
          >
            {children}
          </Provider>
        );
      }
      

      This provider only mounts once, so it shouldn't ever close.

      Version

      0.8.0+

      What services are you using?

      Local Database only

      Are you using encryption?

      Yes

      Platform OS and version(s)

      iPhone 15, OS 17.5

      Build environment

      Expo 51.0.26
      Realm 12.12.1

      Cocoapods version

      No response

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

              Created:
              Updated: