Hi all, I am getting the following error while trying to make a connection to Couchbase Capella

val endpoint = “couchbases://cb.lnrau80fzkslc0kk.cloud.couchbase.com”
val env = ClusterEnvironment.builder().build()
val cluster = Cluster.connect(endpoint, ClusterOptions.clusterOptions(username, password).environment(env))
val bucket = cluster.bucket(bucketName)
cluster.waitUntilReady(Duration.ofMillis(15000))
val scope = bucket.scope(scopeName)
val collection = scope.collection(collectionName)

Error:
WaitUntilReady timed out {“checkedServices”:[],“currentState”:“OFFLINE”,“desiredState”:“ONLINE”,“services”:{“kv”:[{“namespace”:“travel-sample”,“state”:“connecting”,"circuit_b
reaker_state":“disabled”},{“state”:“connecting”,“circuit_breaker_state”:“disabled”}]},“state”:{“current_stage”:“CONFIG_LOAD”,“current_stage_since_ms”:15017,“timings_ms”:{},"t
otal_ms":15017},“timeoutMs”:15000}

Please suggest some solutions to clear this error…

Thanks in Advance…

There should be further details in the WaitUntilReady message. You can also use SDK Doctor to diagnose SDK connectivity issues.
If you get a timeout connecting to cloud with no other diagnostic, it is possible that the client is not in the Allowed IPs.

Error:
strong textWaitUntilReady timed out {“checkedServices”:,“currentState”:“OFFLINE”,“desiredState”:“ONLINE”,“services”:{“kv”:[{“namespace”:“travel-sample”,“state”:“connecting”,“circuit_b
reaker_state”:“disabled”},{“state”:“connecting”,“circuit_breaker_state”:“disabled”}]},“state”:{“current_stage”:“CONFIG_LOAD”,“current_stage_since_ms”:15057,“timings_ms”:{},“t
otal_ms”:15057},“timeoutMs”:15000}
[success] Total time: 20 s, completed 16 Oct, 2023 8:24:23 PM

Oct 16, 2023 8:24:28 PM com.couchbase.client.core.cnc.LoggingEventConsumer$JdkLogger warn
WARNING: [com.couchbase.endpoint][EndpointConnectionFailedEvent][20s] Connect attempt 1 failed because of TimeoutException: Did not observe any item or terminal signal within
20000ms in ‘source(MonoDefer)’ (and no fallback has been configured) {“circuitBreaker”:“DISABLED”,“coreId”:“0x4c6d650d00000001”,“remote”:“svc-dqis-node-001.lnrau80fzkslc0kk.
cloud.couchbase.com:11207”,“type”:“KV”}
java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 20000ms in ‘source(MonoDefer)’ (and no fallback has been configured)

This is the Complete Error Message

You can also use SDK Doctor to diagnose SDK connectivity issues.
If you get a timeout connecting to cloud with no other diagnostic, it is possible that the client is not in the Allowed IPs.

Agreed, that’s the first thing to check :slight_smile:

Also make sure you’re using the latest version of the Couchbase Java SDK. I’m thinking specifically about JVMCBC-1320 which was addressed in version 3.4.9.

On an unrelated note, may I offer a suggestion about this code?

val env = ClusterEnvironment.builder().build()
val cluster = Cluster.connect(endpoint, ClusterOptions.clusterOptions(username, password).environment(env))

Since you’re creating your own ClusterEnvironment object, it’s necessary to shut down the environment after disconnecting the cluster. If you’d rather not have to worry about shutting down the environment, you can configure the environment like this instead:

var cluster = Cluster.connect(
  endpoint,
  ClusterOptions.clusterOptions(username, password)
    .environment(env -> {
      // `env` is a ClusterEnvironment.Builder to customize
    }));

This is how we’d typically recommend customizing the environment for most use cases, since it means you don’t need to worry about shutting down the environment.

Thanks,
David

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