Can not authenticate cluster via node js SDK

node

#1

Hi ,

I upgraded my couchbase cluster from version 4.5.1 to version 6.0
My script is wrriten on nodejs used couch SDK
I tried to connect to old bucket that migrated and it works ,
but - when I tried to connect to new bucket that created in version 5.5.2 it failed , I tried with admin credentials .

my code:

        const cluster = new couchbase.Cluster('hosts');
        cluster.authenticate('UserName', 'Password');
        cbBucket = await cluster.openBucket('bucket');

failure:
CouchbaseError: Authentication failed. You may have provided an invalid username/password combination

Any idea why and how to fix it ?

Thanks ,


#2

@shira.cohen Can you please try the following?

Login as a user with admin credentials into the UI
Go to the Security tab and check the access to the particular buckets for the user


#3

How did you upgrade? If it was a rebalance upgrade, a user with the same name as the bucket should have been automatically created on upgrade. If it was an offline upgrade, this isn’t done for you and you’ll need to create users, etc. This should be covered in the documentation and please hit the “Feedback” button on the docs if you find it unclear and offer suggestions.

In any case, it’s better to create proper application users, give them the right permissions on the buckets they have access to, etc. It is not recommended to use admin credentials.


#4

Hi All ,

Thanks about the replies .

I am using for the tests on admin user , new user that created after the upgrade and it;s not working .
BUT - After an investigation we understood the problem -
We are working on ‘couchbase-promises’ module, this is wrapper of ‘couchbase’ module that implement async-await pattern .
this module (promises) is not up to date for last changes in couch module , the last update for it was 1 year ago , I found open issue with in project: https://github.com/dsfields/couchbase-promises/issues/22

I wrote to couchbase support , they opened a feature request for that:
https://issues.couchbase.com/browse/JSCBC-525

Hope it will be realized soon …

Thanks you all .


#6

Ah, gotcha. Maybe there’s a way to do it right now though-- I think @brett19 might have a suggestion. Brett, can you chime in?