Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling Realm Functions from the User class #4117

Closed
kraenhansen opened this issue Nov 29, 2021 · 1 comment
Closed

Calling Realm Functions from the User class #4117

kraenhansen opened this issue Nov 29, 2021 · 1 comment
Labels
hermes Bugs and features related to running on the React Native hermes engine T-Bug

Comments

@kraenhansen
Copy link
Member

kraenhansen commented Nov 29, 2021

"realm": "10.20.0-alpha.1"
"react-native": "0.66.1"

I'm having an issue calling Realm Functions from the User class. This is on an existing project, and was working before the switch to 10.20.0-alpha.1.

LOG [TypeError: Cannot read property 'findOrganizationsAssociatedByEmailAddress' of undefined]

I log the realmUser object prototype and this is the result:

["*Realm_internal", "constructor", "_customData", "accessToken", "apiKeys", "deviceId", "id", "identities", "isLoggedIn", "profile", "providerType", "refreshToken", "state", "_callFunction", "_linkCredentials", "_logOut", "_makeStreamingRequest", "_newWatchStream", "_pushDeregister", "_pushRegister", "refreshCustomData", "sessionForOnDiskPath", "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "proto", "defineGetter", "defineSetter", "lookupGetter", "*lookupSetter"]

Edit: forgot to mention how I am invoking the realm function:

const organizations = await realmUser.functions.findOrganizationsAssociatedByEmailAddress(emailAddress);

Update: I changed realm back to 10.91.1 and set :hermes_enabled => false, and then everything works as expected again. Logged the realmUser object prototype, and it looks as it should:

["deviceId", "apiKeys", "accessToken", "providerType", "profile", "_customData", "refreshToken", "isLoggedIn", "state", "id", "identities", "_newWatchStream", "_pushRegister", "_linkCredentials", "_pushDeregister", "_refreshCustomData", "_logOut", "_makeStreamingRequest", "_callFunction", "_sessionForOnDiskPath", "linkCredentials", "logOut", "callFunction", "refreshCustomData", "mongoClient", "push", "functions", "auth", "customData", "_functionsOnService", "constructor", "toString", "toLocaleString", "valueOf", "hasOwnProperty", "propertyIsEnumerable", "isPrototypeOf", "defineGetter", "defineSetter", "lookupGetter", "lookupSetter", "proto"]

Originally posted by @harloware in https://github.com/realm/realm~~js/discussions/3978#discussioncomment~~1525162

@kraenhansen kraenhansen added hermes Bugs and features related to running on the React Native hermes engine T-Bug labels Nov 29, 2021
@kneth
Copy link
Contributor

kneth commented Jul 13, 2023

It should be fixed in v12. Please reopen or create a new issue if the error still persists.

@kneth kneth closed this as completed Jul 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hermes Bugs and features related to running on the React Native hermes engine T-Bug
Projects
None yet
Development

No branches or pull requests

2 participants