Also, somewhat related question – is this code safe to run on Couchbase 4.X? If not, is there anything in the SDK to check the capabilities or version to see if RBAC users are supported?
We can then see the relevant changes were made to gocb in https://github.com/couchbase/gocb/commit/f6b4cda035251147c4424668020c24fafdbddbca. If you’re using a version earlier than 1.2.3 (the tag for this commit) I would expect gocb to still be trying to create a ‘builtin’ user which the server would reject as it does not understand what ‘builtin’ is.
2017/05/31 10:10:39 Error UpsertUser: "Cannot assign roles to user because the following roles are unknown, malformed or role parameters are undefined: [admin[test_data_bucket]]"
--- FAIL: TestWriteCasXattrSimple (0.24s)
panic: Could not create bucket. Spec: {Server:http://192.168.33.10:8091 PoolName: BucketName:test_data_bucket FeedType: Auth:{Username:test_data_bucket Password:password BucketName:test_data_bucket} CouchbaseDriver:GoCBCustomSGTranscoder MaxNumRetries:0 InitialRetrySleepTimeMS:0 UseXattrs:true} Err: "Cannot assign roles to user because the following roles are unknown, malformed or role parameters are undefined: [admin[test_data_bucket]]" [recovered]
panic: Could not create bucket. Spec: {Server:http://192.168.33.10:8091 PoolName: BucketName:test_data_bucket FeedType: Auth:{Username:test_data_bucket Password:password BucketName:test_data_bucket} CouchbaseDriver:GoCBCustomSGTranscoder MaxNumRetries:0 InitialRetrySleepTimeMS:0 UseXattrs:true} Err: "Cannot assign roles to user because the following roles are unknown, malformed or role parameters are undefined: [admin[test_data_bucket]]"
I should also mention that this is being called immediately after calling ClusterManager.InsertBucket()
I tried changing the role to “Admin” and go pretty much the same error:
2017/05/31 10:20:41 Error UpsertUser: "Cannot assign roles to user because the following roles are unknown, malformed or role parameters are undefined: [Admin[test_data_bucket]]"