masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
227 stars 67 forks source link

localDataCenter #201

Closed measwel closed 4 years ago

measwel commented 5 years ago

I have installed the latest cassandra driver (4.1.0) and I am trying to load the following options:

clientOptions: {
  contactPoints: [config.contactPoints],
  localDataCenter: 'datacenter1',
  protocolOptions: {port: config.cassandraPort},
  keyspace: config.keyspace,
  queryOptions: {consistency: models.consistencies.one},
  authProvider: new models.driver.auth.PlainTextAuthProvider(config.cassandra_user, config.cassandra_password),
  elasticsearch: {
    apiVersion: '7.2',
    sniffOnStart: false,
    host: config.elastic_server,
    requestTimeout: 60000
  }
},

Even though localDataCenter is specified, the driver throws: error { ArgumentError: 'localDataCenter' is not defined in Client options and also was not specified in constructor. At least one is required.

Is express-cassandra not passing the value to the driver? Is the value an arbitrary name or does it need to have some specific value? If so, where can I determine what it should be?

If I need to use an older cassandra driver, then which version should it be?

measwel commented 5 years ago

Update. I finally found out what is wrong. It turned out, that for some queries I used the cassandra driver from the project node package(4.1), instead of the driver that is included with express-cassandra(3.3). The localDataCenter name was provided to the express cassandra driver, but not the one from the node package.

The newer driver will throw the error, if no datacenter name is provided. I have to either provide it, or use the driver included with express cassandra.