Postgres Connector v1.10.0 is throwing “Error: object must be of type Sync.User”


#1

Hello I am trying to implement the Postgress connector to my DB but my User object is coming back empty and I am getting the following error

UnhandledPromiseRejectionWarning: Error: object must be of type Sync.User

This is the code for my admin user

var admin_user = await Realm.Sync.User.login(
url
Realm.Sync.Credentials.jwt(jwt)
);

I am using node 10 and realm 2.28.0 which is the same version as the Connector module

My realm-object-server is 3.23.1 and my Postgress is 9


#2

Can you log in using a simple node script and verify that JWT token matches a user (it sounds like you already did that)?

Moreover, can you verify that the user is an admin user?

Last, increasing the log level (Realm.Sync.setLogLevel()) might help you to understand why logging is failing.


#3

Thanks for the quick response @kneth ,

When I run await Realm.Sync.User.login(
url,
Realm.Sync.Credentials.jwt(jwt)
).then(res => console.log(res));

My response is “User {}” which Is why it is failing. I have created a JWT token API where in the token I have isAdmin set to true, deviceMacFormatted set the the device mac. I have added a user with the id of the deviceMac in my Realm. I have added the Public Key to my JWT settings in Realm Settings. Im not sure why this isn’t working


#4


#5

I managed to login with Credentials.usernamePassword, however now I am getting this error everytime I run it

UnhandledPromiseRejectionWarning: FetchError: network timeout at: https://my-realm-url.cloud.realm.io/auth

Is there a specification to the internet connectivity for this sync to work?


#6

Its still intermitantly giving the error
Error: Configuration object is not valid. Property realmConfig.user cannot be undefined or null
I have tried also unsuccessfully tried to hard code the admin_user object into realmConfig object without any luck