I've been working with React Native and Expo using the expo-dev-client in order to use Realm in my react native app. From what I understand this is a relatively new system that was created to allow realm to work in a react native / expo app. (Here is the documentation on it)
Once I got MongoDB Atlas setup, everything was going pretty smoothly. I could query the database through my app using the IOS simulator, and it would return what I wanted. This was a big step-up from before when I couldn't even access Realm with react native and expo.
The problem is, as soon as I use the expo-dev-client server on my actual iPhone, the Realm sign-in functions do not work, and I can't access the app. When I use the Realm.Credentials.anonymous() function, it returns the following error:
[json.exception.type_error.302] type must be array, but is object.
Then if I try to use Realm.Credentials.emailPassword(), it just returns:
Possible Unhandled Promise Rejection (id: 0):
TypeError: app.currentUser.mongoClient is not a function
Which from what I could find online just means the 'app.currentUser' doesn't exist, because the sign in function didn't work.
This is very strange, because both of the sign in functions work on my IOS simulator, using the exact same environment and setup. But as soon as I load it on my phone it no longer works.
The only lead I could find after digging into the call stack is that the error is being thrown from the rpc.js file at this point:
export function _anonymousRPC() {
//this is the line it doesn't like
-> const result = sendRequest("_anonymous", { arguments: undefined });
return deserialize(undefined, result);
}
export function _appleRPC() {
const args = Array.prototype.map.call(arguments, (arg) => serialize(null, arg));
const result = sendRequest("_apple", { arguments: args });
return deserialize(undefined, result);
}
export function _emailPasswordRPC() {
const args = Array.prototype.map.call(arguments, (arg) => serialize(null, arg));
const result = sendRequest("_emailPassword", { arguments: args });
console.log(args);
return deserialize(undefined, result);
}
I'm pretty new to using the React Native + Expo dev client and Realm all together, so if anyone has any idea of what's going on I would greatly appreciate the help. Thanks!