Unable to access bucket/collection using cert auth

Hi! I am trying to set up certificate auth and access bucket/collection but getting timeout error. I also have ID and Password setup as well. I am not sure what I am missing.
I referred this page Authentication | Couchbase Docs

	cert, err := tls.LoadX509KeyPair("test.cert.pem", "test.key.pem")
	if err != nil {
		panic(err)
	}

	opts := gocb.ClusterOptions{
		Authenticator: gocb.CertificateAuthenticator{
			ClientCertificate: &cert,
		},
		TimeoutsConfig: gocb.TimeoutsConfig{
			ConnectTimeout: 50000000000,
		},
	}

	cluster, err := gocb.Connect("couchbases://host.test.com", opts)
	if err != nil {
		panic(err)
	}

	err = cluster.Bucket("test").WaitUntilReady(5*time.Second, nil)
	if err != nil {
		panic(err)
	}

for some reason it panics within that waituntilready function
panic: unambiguous timeout | {"InnerError":{"InnerError":{"InnerError":{},"Message":"unambiguous timeout"}},"OperationID":"WaitUntilReady","Opaque":"","TimeObserved":5000416562,"RetryReasons":["NOT_READY","CONNECTION_ERROR"],"RetryAttempts":17,"LastDispatchedTo":"","LastDispatchedFrom":"","LastConnectionID":""}

Is your server Couchbase Enterprise?

Yes. Couchbase enterprise

Can you connect with couchbase://… ?

You could try connecting with SDK Doctor, it usually has better diagnostics.

couchbase://… works fine if i pass this below

			Username: opts.CouchbaseDBUsername,
			Password: opts.CouchbaseDBPassword,
			TimeoutsConfig: gocb.TimeoutsConfig{
				ConnectTimeout: opts.CouchbaseDBConnectTimeout,
			},
		}

I will take a look at SDK doctor.

Hi @kshetty1990 it’d also be worth turning on verbose logging to see what the SDK thinks is happening at the connection level - Logging | Couchbase Docs.

1 Like

Hi all,
This issue has been resolved. It was related to certs that I generated and nothing to do with the sdk or code I was using. Thanks!

1 Like

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