Unable to run my first sample code in dotnet console application

Error Details
System.AggregateException
HResult=0x80131500
Message=Cluster has not yet bootstrapped. Call WaitUntilReadyAsync(…) to wait for it to complete.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Runtime.CompilerServices.ValueTaskAwaiter1.GetResult()
at CouchBaseDemo.Program.d__0.MoveNext() in D:\Web Applications\CouchBaseDemo\Program.cs:line 63

Code:

class Program
{
static async Task Main(string args)
{
// Update this to your cluster
var endpoint = “couchbases://cb.y-q7gd97sckygoqr.cloud.couchbase.com”;
var username = “username”;
var password = “password”;
var bucketName = “travel-sample”;
var scopeName = “inventory”;
var collectionName = “airport”;
// Sample airline document
var key = “airline_8091”;
var content = new JObject
{
{ “type”, “airline” },
{ “id”, 8091 },
{ “callsign”, “CBS” },
{ “iata”, null },
{ “icao”, null },
{ “name”, “Couchbase Airways” }
};
var clusterOptions = new ClusterOptions
{
UserName = username,
Password = password
};
clusterOptions.ApplyProfile(“wan-development”);
var cluster = await Cluster.ConnectAsync(endpoint, clusterOptions);
//await cluster.WaitUntilReadyAsync(TimeSpan.FromSeconds(10));
//await cluster.WaitUntilReadyAsync(new TimeSpan(0, 2, 0));
var bucket = await cluster.BucketAsync(bucketName);
// Wait until the bucket is ready for use
await bucket.WaitUntilReadyAsync(TimeSpan.FromSeconds(10));
// Get the reference to the scope
var scope = await bucket.ScopeAsync(scopeName);
// Get a reference to our collection
var collection = await scope.CollectionAsync(collectionName);
// Simple KV operation - to create a document with specific ID
try
{
var mutationResult = await collection.InsertAsync(key, content);
Console.WriteLine($“Create document success. CAS: {mutationResult.Cas}”);
}
catch (CouchbaseException ex)
{
Console.WriteLine(ex);
return;
}
// Simple KV operation - to retrieve a document by ID
JObject result = null;
try
{
result = (await collection.GetAsync(key)).ContentAs();
Console.WriteLine($“Fetch document success. Result: {result.ToString()}”);
}
catch (DocumentNotFoundException ex)
{
Console.WriteLine(ex);
return;
}
// Simple KV operation - to update a document by ID
try
{
result[“name”] = “Couchbase Airways!!”;
var mutationResult = await collection.ReplaceAsync(key, result);
Console.WriteLine($“Update document success. CAS: {mutationResult.Cas}”);
}
catch (CouchbaseException ex)
{
Console.WriteLine(ex);
return;
}
// Simple K-V operation - to delete a document by ID
try
{
await collection.RemoveAsync(key);
Console.WriteLine(“Delete document success.”);
}
catch (DocumentNotFoundException ex)
{
Console.WriteLine(ex);
}
}
}

I am facing below error.
Cluster has not yet bootstrapped. Call WaitUntilReadyAsync(…) to wait for it to complete.
I was tried firewall disable mode. Also tried by adding Open inbound TCP ports 8091, 8092, 11210.
But still facing this issue. Please help anyone regarding this.

Thanks
Ashwin

A few things you can try.

  1. Enable logging to see the more detailed errors from the bootstrap process
  2. Try running the SDK Doctor to ensure you have good connectivity
1 Like

On Capella there is an “Allow IP Addresses” which will open the necessary ports to the specified IP. (for an initial test sometimes I just allow all ip addresses).

couchbases:// (with a trailing s) is ssl.

port 18091 is the ssl management port
port 18092 is the ssl views port
port 18093 is the ssl query port
port 18094 is the ssl fts/search port
port 11207 is the ssl kv port.

Refer to Couchbase Server Ports | Couchbase Docs

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.