appy-one / acebase-client

Client to connect to remote AceBase NoSQL database server
MIT License
21 stars 8 forks source link

Could not get server info, update your acebase server version #55

Closed srebling closed 1 year ago

srebling commented 1 year ago

Getting this message when trying a simple client connection. 'Could not get server info, update your acebase server version' I am using the latest version. Also receive a 'not found' error when issuing a db.ref().get() on a paths that I know exist. No authentication or signin needed for this use case. This is all on the same localhost (OSX 10.15.7, node v16.14.2). The database was generated with a node.js app using just the acebase engine, which works very well and as expected for reading and writing to the database. The code below is running in two separate terminal instances. What am I missing? Thanks.

Server code:

const { AceBaseServer } = require('acebase-server');
const dbname = '../../PG-Messages';

const settings = {
    host: 'localhost',
    port: 5757,
    authentication: {
        enabled: false,
        allowUserSignup: false,
        defaultAccessRule: 'allow',
        defaultAdminPassword: '75sdDSFg37w5'
    }
}

const server = new AceBaseServer(dbname, settings);
server.on('ready', () => {
    console.log("SERVER ready");
});

Client code:

const { AceBaseClient } = require('acebase-client');
const db = new AceBaseClient({ host: "localhost", port: 5757, dbname: '../../PG-Messages', https: false });
db.ready(() => {
    console.log('Connected successfully');
    getMsg('/');
});

async function getMsg(path){
    let msg = {};
    const snapshot = await db.ref(`messages${path}`).get();
    if (snapshot.exists()) {
        msg = snapshot.val();
    }
    else {
        msg = 'No messages'; // use defaults
    }
    console.log('get result:', msg);
}

package.json:

{
  "name": "acebase-test",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "acebase": "^1.26.2",
    "acebase-client": "^1.20.0",
    "acebase-server": "^1.16.2"
  }
}
donl commented 1 year ago

I doubt AceBase supports having / in the database name when using the server or client.

If you are trying to have the server store the database in a specific path, there is a configuration option path for that (might be missing from the documentation).

srebling commented 1 year ago

I added a path: "../../" property to the server settings and removed it from the dbnames. It is working now. Thanks for pointing that out. The main acebase engine docs do mention the path property, I overlooked it while trying out the server/client packages.