Hello, I’m running into an error using the [app.deleteUser]
(https://www.mongodb.com/docs/realm/web/create-delete-user/#:~:text=Call%20the%20App.,addition%20to%20clearing%20local%20data.) and useUser hook.
I am trying to add functionality to delete a realm user (from the server and from the device). I have tried the following (and encountered the following errors):
app.deleteUser(user)
When I call this function, the user gets deleted and the app crashes.
I encounter this error: {"errorCode": 1, "message": "user_not_found"}
I am having trouble tracing this error, but so far as I can tell, the children of <UserProvider>
are getting rendered—I have a fallback
, which is not rendering despite the user deletion succeeding.
When I restart the app, the app uses the fallback
passed to <UserProvider>
.
app.removeUser(user)** or **user.logOut()
If I call either of these functions followed by an app.deleteUser()
, I encounter this error: User must be logged in to be deleted.
If I add a loading state and call either of these functions after app.deleteUser()
, I encounter this error: Exception in HostFunction: User is no longer valid.
app.removeUser(user); app.deleteUser(_.clone(user));
The app continues to run, but the intended behavior does not occur; the user does not get deleted. (The user merely gets removed/logged out, depending on the function I call before app.deleteUser.)
So… I need help: How do I delete a user and ensure that the renders its fallback component? (Post-deletion, it seems the app still thinks a user object exists.)
Thanks,
Alex