Nodejs N1QL query - application crashes


Have a problem when running N1QL queries. Running node.js project with nodemon … Error output with nodemon doesnt say anything about the problem.

“[nodemon] app crashed - waiting for file changes before starting…”

Connecting too couchbase bucket works fine.
Creating documents with couchbase sdk for node.js works fine.

But when running N1QL queries just crash my application… Default bucket is installed for testing purpose.

var N1qlQuery = require('couchbase').N1qlQuery;
var myBucket = myCluster.openBucket();
var query = N1qlQuery.fromString('SELECT * FROM default');
myBucket.query(query, function(err, res) {
  if (err) {
    console.log(‘query failed’, err);
  console.log(‘success!’, res);

I am using node version 4.1.1, couchbase SDK 2.1.1 and couchbase 4 RC0. Is there any chance of getting these error messages? It doesn’t even print “query failed”.

Have also tested to create primary index on default bucket and other buckets… N1QL queries works fine using cbt …

Best regards

Hey @Johannes,

There is a known issue with 2.1.1 which causes a segmentation fault when using enableN1ql. This will be corrected in the upcoming 2.1.2 version. However, if you are using Couchbase Server 4.0 you should consider removing your enableN1ql call entirely. With Couchbase Server 4.0, N1QL is fully integrated with the server, allowing the SDKs to automatically have knowledge of all available N1QL endpoints.

Cheers, Brett

1 Like

Thanks for really quick replay! It works great when removing enableN1ql.

You guys should update (remove enablen1ql) on node.js sdk pages…

Anyway thanks alot!