Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-824

Authentication exception when opening memcached bucket with password from ClientConfiguration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: library
    • Labels:
      None

      Description

      If you try to open a password protected memcached bucket with a configuration containing the password (but only when you call OpenBucket(name) and not OpenBucket(name, password), the client will throw an exception as follows:

      System.AggregateException : Could not bootstrap - check inner exceptions for details.

      ----> Couchbase.Configuration.ConfigException : is this a Memcached bucket?

      If you look at the logs you'll find it's really a WebException with a response of unauthorized:

      2015-02-17 10:17:12,583 [Runner thread] ERROR Couchbase.Configuration.Server.Providers.Streaming.HttpServerConfig - Bootstrapping failed from http://192.168.27.102:8091/pools: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
      at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
      at System.Net.WebClient.DownloadString(Uri address)
      at Couchbase.Configuration.Server.Providers.Streaming.HttpServerConfig.DownLoadConfig[T](Uri uri) in c:\jenkins\workspace-net2\couchbase-net-client\Src\Couchbase\Configuration\Server\Providers\Streaming\HttpServerConfig.cs:line 115
      at Couchbase.Configuration.Server.Providers.Streaming.HttpServerConfig.DownloadConfigs(Uri server) in c:\jenkins\workspace-net2\couchbase-net-client\Src\Couchbase\Configuration\Server\Providers\Streaming\HttpServerConfig.cs:line 62

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

            Hide
            jmorris Jeff Morris added a comment -

            Will not work:

            var config = new ClientConfiguration
            {
            Servers = new List<Uri>

            { new Uri("http://192.168.27.101:8091/pools"), new Uri("http://192.168.27.102:8091/pools"), new Uri("http://192.168.27.103:8091/pools") }

            ,
            BucketConfigs = new Dictionary<string, BucketConfiguration>
            {
            {
            "default",
            new BucketConfiguration

            { BucketName = "distributed_cache", Password = "secret" }

            }
            }
            };

            var cluster = new Cluster(config);
            var bucketName = config.BucketConfigs.Single().Value.BucketName;
            var bucket = cluster.OpenBucket(bucketName);
            var result = bucket.Get<string>("some_key");

            Show
            jmorris Jeff Morris added a comment - Will not work: var config = new ClientConfiguration { Servers = new List<Uri> { new Uri("http://192.168.27.101:8091/pools"), new Uri("http://192.168.27.102:8091/pools"), new Uri("http://192.168.27.103:8091/pools") } , BucketConfigs = new Dictionary<string, BucketConfiguration> { { "default", new BucketConfiguration { BucketName = "distributed_cache", Password = "secret" } } } }; var cluster = new Cluster(config); var bucketName = config.BucketConfigs.Single().Value.BucketName; var bucket = cluster.OpenBucket(bucketName); var result = bucket.Get<string>("some_key");
            Hide
            jmorris Jeff Morris added a comment -

            A work around is to explicitly provide the password when opening the bucket:

            var config = new ClientConfiguration
            {
            Servers = new List<Uri>

            { new Uri("http://192.168.27.101:8091/pools"), new Uri("http://192.168.27.102:8091/pools"), new Uri("http://192.168.27.103:8091/pools") }

            ,
            BucketConfigs = new Dictionary<string, BucketConfiguration>
            {
            {
            "default",
            new BucketConfiguration

            { BucketName = "distributed_cache", Password = "secret" }

            }
            }
            };

            var cluster = new Cluster(config);
            var bucketName = config.BucketConfigs.Single().Value.BucketName;
            var bucket = cluster.OpenBucket(bucketName);
            var result = bucket.Get<string>("some_key", "secret");

            Show
            jmorris Jeff Morris added a comment - A work around is to explicitly provide the password when opening the bucket: var config = new ClientConfiguration { Servers = new List<Uri> { new Uri("http://192.168.27.101:8091/pools"), new Uri("http://192.168.27.102:8091/pools"), new Uri("http://192.168.27.103:8091/pools") } , BucketConfigs = new Dictionary<string, BucketConfiguration> { { "default", new BucketConfiguration { BucketName = "distributed_cache", Password = "secret" } } } }; var cluster = new Cluster(config); var bucketName = config.BucketConfigs.Single().Value.BucketName; var bucket = cluster.OpenBucket(bucketName); var result = bucket.Get<string>("some_key", "secret");
            Hide
            simonbasle Simon Baslé (Inactive) added a comment -

            NCBC-818 is similar, but in ClusterHelper

            Show
            simonbasle Simon Baslé (Inactive) added a comment - NCBC-818 is similar, but in ClusterHelper
            Show
            simonbasle Simon Baslé (Inactive) added a comment - see commit https://github.com/couchbase/couchbase-net-client/commit/604f9f0db94e303adf7767743b83b99b61aa0eb4

              People

              • Assignee:
                simonbasle Simon Baslé (Inactive)
                Reporter:
                jmorris Jeff Morris
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.