Robert
Robert

Reputation: 180

Cassandra client error on NodeJS

Trying to use cassandra driver 3.5 in a nodejs app. When instantiating the client via cassandra.Client({}), it erros with:

TypeError: Cannot read property 'bind' of undefined
at Object.Client (....path..../lambdas/data-upload/node_modules/cassandra-driver/lib/client.js:307:63)

line 307 of the client code is:

this.options = clientOptions.extend({ logEmitter: this.emit.bind(this) }, options);

so the "this.emit.bind" is where it is failing.

The environment is node 8.10 (tried 8.11 as well) and driver version 3.5 (tried 3.4 but has same code).

Upvotes: 1

Views: 410

Answers (1)

Robert
Robert

Reputation: 180

Found the problem, after about 8 hours of digging. I wasn't "new"ing the class.

I was doing:

const client = cassandra.Client(....)  

instead of (correct)

const client = new cassandra.Client(....)

Upvotes: 3

Related Questions