-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
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