Data sync from ROS to PostgreSQL and vice versa is not working


#1

Here is my adapter.js

const adminToken = require(’./adminToken’);
const express = require(‘express’);
// const app = express();
const Realm = require(‘realm’);
const fs = require(‘fs’);
path = require(‘path’).basename(__dirname);
const PostgresAdapter = require(‘realm-postgres-adapters’).PostgresAdapter;
const Config = require(’./config’);
const Models = require(’./realmmodels’);
path = path+"/data/realms/default.realm";
const adminTokenUser = adminToken.adminToken;
realmPath = Config.realm_object_server_url;
table_name = ‘pricing_item’
async function main() {
var admin_user = await Realm.Sync.User.login(Config.auth_server_url, Config.admin_username, Config.admin_password);
process.on(‘uncaughtException’, (err) => console.log(err));

process.on(‘uncaughtException’, (err) => console.log(err));

var adapter = new PostgresAdapter({
realmConfig: {
server : Config.realm_object_server_url,
user: admin_user,
},
dbName: Config.database_name,
postgresConfig: Config.postgres_config,
resetPostgresReplicationSlot: true,
createPostgresDB: false,
initializeRealmFromPostgres: false,
applyRealmSchemaChangesToPostgres: true,
realmRegex : Config.realm_object_server_url,
mapPostgresChangeToRealmPath: Config.target_realm_path,
mapRealmChangeToPostgresTable: ‘pricing_item’,
schema: Models,

  printCommandsToConsole: true,

});
}

main();


#2

What version of Postgres, the adapter, and Realm JS are you using? Are you trying to authenticate using an admin token rather than username + password? Is there a specific error that you are receiving?


#3

I am not receiving any errors adapter.js script looks working fine. And able to replicated data from PostgreSQL to ROS, If i update any thong in ROS, same updates are not getting reflected in PostgreSQL,

I am trying to authenticate via username and password which I’ve created on UI part of Realm Object Server with permissions of administrator.

PostgresSQL 10,
“realm”: “^2.18.0”,
“realm-object-server”: “3.11.5”,
“realm-postgres-adapters”: “file:…/Downloads/realm-postgres-adapters-1.3.0-rc.1.tgz”