Hello,
I stumble upon a strange behavior when trying to open a bucket using PasswordAuthenticator.
First of all, if I specify correct user name and incorrect password I’m getting an error:
"Authentication failed for bucket ‘userName’“
I expected to see there a bucket name I was trying to open and perhaps something like
"Authentication failed for user ‘userName’”
But the real problem is when I initiate cluster configuration using app.config. In this case, I cannot open a bucket using authenticator. However, if I run almost identical code, where I create new cluster and only set server list for it, everything is working as expected and I can open a bucket with correct credentials.
How to replicate (code that produces exception):
Cluster cluster = new Cluster(configurationSectionName: "couchbaseClients/couchbase");
var auth = new Couchbase.Authentication.PasswordAuthenticator(userName, password);
cluster.Authenticate(auth);
return cluster.OpenBucket(bucketName);
Exceptions:
“Could not bootstrap - check inner exceptions for details.”
“One or more errors occurred.”
The same bucket and the same credentials can open a bucket successfully if initialized like this:
Cluster cluster = new Cluster(
new Couchbase.Configuration.Client.ClientConfiguration() {
//Servers = _Cluster.Configuration.Servers - it works too, here _Cluster is initialized using app.config
Servers = new List<Uri> { new Uri("http://xxx.xxx.xxx.xxxx:8091") }
}
);
var auth = new Couchbase.Authentication.PasswordAuthenticator(userName, password);
cluster.Authenticate(auth);
App.config related to couchbase is:
<configSections>
<sectionGroup name="couchbaseClients">
<section name="couchbase" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
</sectionGroup>
</configSections>
<couchbaseClients>
<couchbase useSsl="false">
<servers>
<add uri="http://xxx.xxx.xxx.xxx:8091"></add>
</servers>
<buckets>
<add name="xxxxx" password="*******">
<connectionPool name="custom" maxSize="10" minSize="5" sendTimeout="12000">< /connectionPool>
</add>
</buckets>
</couchbase>
</couchbaseClients>
Any advises what is the difference between initializing a cluster from app.config and directly from the code?