Key present in bucket but the api is returning “Key cannot be null or empty” for few key

I am using Couchbase.NET client 2.4.8.1 to retrieve the document from a bucket. We have 4 data and query nodes in the same m/c and 2 index nodes in a different m/c. Couchbase version 5.1

We are able to fetch the document from workbench but the api is returning “Key cannot be null or empty.” with the response status as “ClientFailure”. Please help, code snippet given below, N1QL is also working

        var config = new ClientConfiguration
        {
            Servers = new List<Uri> {
               new Uri("http://xxx.xxx.xxx.xx:8091")

           }
        };

        //create the cluster and pass in the RBAC user
        var cluster = new Cluster(config);
        var credentials = new PasswordAuthenticator("xxx_yyy", "*****");
        cluster.Authenticate(credentials);

        //open the new bucket
        var bucket = cluster.OpenBucket("xxx_yyy", "*****");

        var airportPOI = bucket.GetDocument<dynamic>("Travel::A23::A24");
        Console.Write(airportPOI);


        var queryRequest = new QueryRequest()
                        .Statement("select * from xxx_yyy use keys 'Travel::A23::A24'");

        var result = bucket.Query<dynamic>(queryRequest);
        Console.Write(result);

If you’re using the PasswordAuthenticator, you should not pass a password to OpenBucket. That password is there only for backwards compatibility with pre-5.0 Couchbase servers. Try removing that and see what happens.

2 Likes