Unable to Access bucket from dotnet core

Hi All,

I have installed couchbase community server (v7) on ubuntu server 20.04, and i trying to connect to bucket from dotnet core but I am getting bucket not found or its unreachable can anyone please help me to resolve this issue, below are the more details

Platform: Ubuntu 20.04 server
Couchbase edition: community v7.0.2 build 6703
Trying to access from: Dotnet core 3.1 (Console app)
Installed SDK: 3.2.7
Line i am getting error: var bucket = await cluster.BucketAsync(bucketName);

I have few buckets created along with the default bucket and also i assigned user to the bucket via application role. I tried watching YouTube but there they have full bucket access role for a user which i dont have it in current couchbase edition. Just suspecting the error i am facing is because of that?

I have only two roles in my couchbase server (Application Access, FullAdmin)

Please suggest

Thanks!!

Welcome @SharashchandraUdupa !

Was the bucket just created by chance? If so, it can take a bit of time for this to propagate.

Can you post the full set of exception lines? Also, you may want to turn up logging to see any details? If that looks good, check the memcached.log on the server side.

You can also try sdk-doctor from the same place you’re running the client. It can diagnose various connection/configuration problems.

Hi @ingenthr

thank you for your reply
Here is the sdk-doctor log:

|====================================================================|
| ___ ___ _ __ ___ ___ ___ _____ ___ ___ |
| / | | |/ /| \ / _ \ / | / _ | _ \ |
| _
\ |) | ’ <
| |) | () | (_ | || () | / |
| |
//||_\ |/ _/ _| || __/||_\ |
| |
|====================================================================|

Note: Diagnostics can only provide accurate results when your cluster
is in a stable state. Active rebalancing and other cluster configuration
changes can cause the output of the doctor to be inconsistent or in the
worst cases, completely incorrect.

10:42:11.422 INFO :arrow_forward: Parsing connection string couchbases://ip_address/test
10:42:11.425 INFO :arrow_forward: Connection string specifies to use secured connections
10:42:11.425 INFO :arrow_forward: Connection string identifies the following CCCP endpoints:
10:42:11.426 INFO :arrow_forward: 1. ip_address:11207
10:42:11.426 INFO :arrow_forward: Connection string identifies the following HTTP endpoints:
10:42:11.426 INFO :arrow_forward: 1. ip_address:18091
10:42:11.426 INFO :arrow_forward: Connection string specifies bucket test
10:42:11.426 WARN :arrow_forward: No certificate authority file specified (–tls-ca), skipping server certificate verification for this run.
10:42:11.426 WARN :arrow_forward: Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
10:42:11.426 INFO :arrow_forward: Performing DNS lookup for host ip_address
10:42:11.426 INFO :arrow_forward: Attempting to connect to cluster via CCCP
10:42:11.426 INFO :arrow_forward: Attempting to fetch config via cccp from ip_address:11207
10:42:13.427 ERRO :arrow_forward: Failed to fetch configuration via cccp from ip_address:11207 (error: dial tcp ip_address:11207: i/o timeout)
10:42:13.427 INFO :arrow_forward: Attempting to connect to cluster via HTTP (Terse)
10:42:13.427 INFO :arrow_forward: Attempting to fetch terse config via http from ip_address:18091
10:42:15.429 ERRO :arrow_forward: Failed to fetch terse configuration via http from ip_address:18091 (error: Get “http://ip_address:18091/pools/default/b/test”: context deadline exceeded (Client.Timeout exceeded while awaiting headers))
10:42:15.429 INFO :arrow_forward: Attempting to connect to cluster via HTTP (Full)
10:42:15.429 INFO :arrow_forward: Failed to connect via HTTP (Full), as it is not yet supported by the doctor
10:42:15.429 INFO :arrow_forward: Selected the following network type:
10:42:15.429 ERRO :arrow_forward: All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible
10:42:15.430 INFO :arrow_forward: Diagnostics completed

Summary:
←[33m[WARN]←[0m No certificate authority file specified (–tls-ca), skipping server certificate verification for this run.
←[33m[WARN]←[0m Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
←[31m[ERRO]←[0m Failed to fetch configuration via cccp from ip_address:11207 (error: dial tcp ip_address:11207: i/o timeout)
←[31m[ERRO]←[0m Failed to fetch terse configuration via http from ip_address:18091 (error: Get “http://ip_address:18091/pools/default/b/test”: context deadline exceeded (Client.Timeout exceeded while awaiting headers))
←[31m[ERRO]←[0m All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible

Found multiple issues, see listing above.

Here is the stacktrace:
StackTrace " at Couchbase.Core.ClusterContext.d__58.MoveNext()\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()\r\n
at Couchbase.Cluster.<>c__DisplayClass30_0.<b__0>d.MoveNext()\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()\r\n

Code:


Getting error on the highlighted line

I am not getting what exactly went wrong please help me out.
Thanks!!

I resolved the issue by changing the connection string from couchbases:// to http://

The sdk-doctor output shows that it couldn’t connect to port 11207, which is the TLS port. If it’s not possible to connect to this port, things won’t work. You’ll need to fix the connectivity problem. See the docs on what ports need to be available client to server.

As to the stack trace, that’s the async job waiting for the IO. We can’t see specifics there, but it’s likely what the sdk-doctor found.

You’ve shifted from TLS to non-TLS. You could do the same by going to “couchbase://” from “couchbases://”. The “couchbase” scheme is recommended. I would recommend you go back to that if you can.

Just checked couchbase:// its working…

Thank you