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


#1
User.login is deprecated. Please use User.login(server, Credentials.usernamePassword(...)) instead.
(node:23505) UnhandledPromiseRejectionWarning: Error: object must be of type Sync.User
    at new PostgresAdapter (/Users/kneth/Projects/data-adapters/packages/postgres/src/PostgresAdapter.ts:302:24)
    at main (/home/deploy/apps/postgres-adapter-scripts/adapter.js:17:17)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:23505) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:23505) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Seems like a Typescript type is incorrectly declared somewhere?

EDIT: Wondering whether this is the issue: https://github.com/realm/realm-js/issues/852

We’re on the developer plan, is it still the case that sync is disabled for realm on linux?


#2

Can you post a snippet which shows how you log in?

In general, it should be something like Realm.Sync.User.login(auth_server_url, Realm.Sync.Credentials.adminToken(adminToken)).


#3

This was solved via support. The error resulted from a version mismatch between realm.js and realm-postgres-adapters

I fixed it by deleting the node_modules directory and package.json and reinstalling realm with the correct version and reinstalling realm-postgres-adapters. My Node version was also incorrect, I needed to upgrade from v8 to v10.

Sync is now working flawlessly! Thanks for your hard-work on this @kneth