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

Calling Realm Functions from the User class

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      "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_

            Assignee:
            Unassigned Unassigned
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: