Bucket with name myBucket does not exist

Hi, Am using the below code to connect and read documents from the bucket. And am getting the error as “Bucket with name myBucket does not exist”. But the bucket has existed.
var cluster = await Cluster.ConnectAsync("couchbase://ipaddress", CBUserName, CBPassword);
var bucket = await cluster.BucketAsync(CBBucketName);

And the ipaddress also verified. Is there anything else to check?

Thanks in advance.

Getting cluster object as
{ "clusterServices": {}, "queryIndexes": {}, "analyticsIndexes": {}, "searchIndexes": {}, "buckets": {}, "users": {} }
can you help @borrrden ?


Can you try adding this after your cluster connect call:

await cluster.WaitUntilReadyAsync(TimeSpan.FromSeconds(10));

That should wait until the cluster is fully bootstrapped and initialised, and should then allow you to connect to the bucket. There are also WaitUntilReadyOptions if you want to wait for some specific ClusterState or service to be available.

Hope this helps,

Thanks for response.@WB
I tried this await cluster.WaitUntilReadyAsync(TimeSpan.FromSeconds(10)); with no positive response.

Any other ways ?

Hi @venkatreddy,

Could you make sure the casing is the same? e.g. cluster.BucketAsync(“myBucket”) will return a “does not exist” error if your bucket is actually called “mybucket” or “MYBUCKET”, etc.

Another reason you might get this error is if the credentials you are using don’t have access to that bucket. e.g. if CBUserName and CBPassword correspond to “user1”, then user1 must have permissions for that bucket.

Thanks @matthew.groves
Am sure. Am using case sensitive bucket name.
And here actually getting cluster object is with empty buckets and empty fields as below:
{ "clusterServices": {}, "queryIndexes": {}, "analyticsIndexes": {}, "searchIndexes": {}, "buckets": {}, "users": {} }

What version of Couchbase Server are you using? What version of the Couchbase .NET SDK are you using?

Couchbase server version is Community Edition 6.5.1 .
Couchbase .NET SDK version is CouchbaseNetClient 3.0.3

And I tried with CouchbaseNetClient v2.7.13
The response is ERROR :
"Could not bootstrap - check inner exceptions for details.
(Exception has been thrown by the target of an invocation.)(Could not bootstrap with CCCP. (Exception has been thrown by the target of an invocation.))

This could be a connection/networking issue? Try running sdk-doctor and see what information it gives you: https://github.com/couchbaselabs/sdk-doctor

We are using lambda and EC2 with VPC so not able to use SDK -Docotor for debug in lambda .

But now we are getting response data as expected using GetDocument method (using CouchbaseNetClientSDK 2.7)
but when we use N1QL query (CouchbaseNetClientSDK 2.7) , Response is “End point Request timed out”

And getting same error response when CouchbaseNetClientSDK 3.0 used

can you please assist with any other solutions. for your information we are using single node Community Edition server 6.5.1

can you please help me @matthew.groves

It sounds like a networking issue to me, and I don’t have much experience with AWS networking stuff, so I don’t have any good suggestions.

I’ll ping @ingenthr who might have a better idea on how to proceed?

@matthew.groves Thanks for your support

@ingenthr Can you please help us with this issue?

Ok, so your using AWS Lambda; this is most definitely related to the Lambda environment and changes made recently to it by AWS to aggressively suspend resources that are not being used; this broke a lot of users of AWS Lambda. There is some documentation here.

@jmorris Thanks for your response. So AWS lambda is not support as per my understand to access Couchbase documents for CRUD operations.

Can you please assist, what are other ways we can perform CRUD operations on Couchbase server documents?

It would be really helpful for us.

Can we do same CRUD operation with Node j’s client SDK with Aws lambda?

There is a work-around; use the Ping() functionality in the SDK before sending the K/V operation. If the Ping() returns an error, re-initialize the cluster/bucket objects. The AWS Lambda issue with freezing/thawing effects all SDK’s as its the AWS environment itself which is terminating any long running socket connections.

1 Like

Just to add on here, AWS have told us that the freeze/thaw should not interrupt any connections that are made with TCP Keepalive. The version of .NET core in use though we’ve seen different things in bugs and docs. I think we’re enhancing the SDK to log if it cannot set TCP Keepalive. Currently, it tries to set TCP keepalive and just silently logs if the platform says it cannot.

All of that said, the workaround @jmorris points out is something we have some reports solves the issue, and it’s pretty low cost. A ping, in particular if you ping the CB service you care about, costs a few bytes but ensures the service is ready when you go to use it.

We’re looking into more work here too-- this is the state of the art at the moment.

Hi @jmorris @ingenthr

var cluster = new Cluster(new ClientConfiguration
Servers = new List<Uri> { new Uri("") },
QueryRequestTimeout = 10000000,
var authenticator = new PasswordAuthenticator("username", "password"); cluster.Authenticate(authenticator); var bucket = cluster.OpenBucket("BucketName");
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
/////Getting documents code
IDs.ForEach(id =>
var get = bucket.GetDocument<dynamic>("statusLog_" + id);
if (get != null && get.Document != null && get.Document.Content != null)
var doc = ((JObject)get.Document.Content).ToObject<Dictionary<string,object>>();
///End of Getting documents code
return Ok(new { Response = list});

If I replaced the above documents getting code with below. Am getting Gateway timeout 504.
I used Ping() as below (At Ping() only getting Gateway timeout 504.)
//pingReport = bucket.Ping();`

var queryRequest = new QueryRequest("SELECT * FROM BucketName WHERE type=$1 AND userID=$2")
.Timeout(new TimeSpan(0, 10, 0));
var result = bucket.QueryAsync<dynamic>(queryRequest).GetAwaiter().GetResult();

I don’t know of anything in the Couchbase Query service that should return an HTTP 504. Question: what can you tell us about the Couchbase Server environment? Is it deployed to EKS or do you have some special setup across networks?

@venkatreddy -

Let’s try enabling logging and capture the bootstrapping up until the 504 is returned.

You can use one of the adapters above or use serilog:

<PackageReference Include="Serilog.Extensions.Logging.File" Version="2.0.0-dev-00039" />

IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddLogging(builder => builder
            .AddFilter(level => level >= LogLevel.Debug)
var loggerFactory = serviceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
loggerFactory.AddFile("Logs/myapp-{Date}.txt", LogLevel.Debug);

var clusterOptions = new ClusterOptions().WithCredentials("Administrator", "password").WithLogging(loggerFactory);

Also, note that you can use var report = await cluster.PingAsync(ServiceType.Query).ConfigureAwait(false); to just ping the service itself.