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?
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.
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": {} }
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.))
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
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.
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.
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.
var cluster = new Cluster(new ClientConfiguration { Servers = new List<Uri> { new Uri("http://00.00.000.000") }, 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>>(); list.Add(doc); } });
///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") .AddPositionalParameter("documenttype") .AddPositionalParameter(id) .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?