Running node.js app with N1QL - bucket not found

n1ql

#1

Hi,

I’m trying to connect to my couchbase server using node.js SDK and execute a simple N1QL to fetch objects from a bucket. But it returns me code -25.

{ [CouchbaseError: The bucket requested does not exist] message: ‘The bucket requested does not exist’, code: 25 }

The data bucket do exist and I tried adding enableN1QL as well , still no luck.

No issues in adding data to these buckets though. Anyone faced this issue ?.


#2

Hey @akalyana,

What version of the Node.js SDK are you running and what version of Couchbase Server?

Best,


#3

Node - v4.2.4
Couchbase server - 4.0.0


#4

Hey @akalyana,

What version of the Node.js SDK though? You gave me the version of Node.js, but not the Couchbase SDK version. Also are you using Couchbase Server CE or EE?

Best,


#5

Its 2.1.3. Got this working. The documentation says,

var N1qlQuery = require(‘couchbase’).N1qlQuery;
var myBucket = myCluster.openBucket();
var query = N1qlQuery.fromString(‘SELECT * FROM default’);

This didnt work me till I added the bucket name in openBucket();

var myBucket = myCluster.openBucket(‘default’, function(err) {}); did the trick.


#6

Awesome. Glad you got it :slightly_smiling: