node.js - Couchbase error : Authentication failed when querying a protected bucket Nodejs -


below sample code query pass protected bucket in couchbase in nodejs

var couchbase = require("couchbase"); var cluster = new couchbase.cluster("couchbase://127.0.0.1"); var n1qlquery = couchbase.n1qlquery; var bucket = cluster.openbucket('bucketname', 'admin123'); var  q = n1qlquery.fromstring('select * `bucketname`'); var  req = bucket.query(q); req.on('row',  function (row) {         console.log('got row'); }); req.on('error',  function (err) {         console.error('got error %j',  err);     process.exit(0); }); req.on('end',  function (meta) {         console.log('all rows received. metadata %j:',  meta);     process.exit(0); }); 

getting:
   couchbaseerror: authentication failed. may have provided invalid username/password combination

admin123 looks root password. have provide password specific bucket. create password bucketname bucket in admin ui , pass password.

if didn't set up, might blank,

var bucket = cluster.openbucket('bucketname',''); 

might work you.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -