SyncGateway cannot create indexes

I receive an error when I try to start my sync gateway:

[INF] Successfully opened bucket sync
[INF] Set query timeouts for bucket sync to cluster:1m15s, bucket:1m15s
[INF] Initializing indexes with numReplicas: 1…
[INF] Verifying index availability for bucket sync…
[INF] Indexes ready for bucket sync.
[INF] delta_sync enabled=false with rev_max_age_seconds=86400 for database fwws-cluster-default
[INF] Created background task: “CleanAgedItems” with interval 10m0s
[INF] Created background task: “InsertPendingEntries” with interval 2.5s
[INF] Created background task: “CleanSkippedSequenceQueue” with interval 30m0s
[ERR] cbgt index creation failed: manager_api: could not create index, indexDefs.ImplVersion: “NS41LjA=” > mgr.version: 5.5.0 – base.(*CbgtContext).StartManager() at dcp_sharded.go:298
[ERR] Error opening database my_database: manager_api: could not create index, indexDefs.ImplVersion: “NS41LjA=” > mgr.version: 5.5.0 – rest.RunServer() at config.go:1028

Does anyone know what trigger an error like this?

seems your couchbase server version is 5.5.0, may I ask what sync gateway version are you running?

BTW, does the user have permission to create index on the underlying bucket?

I am also getting same error.

2020-07-22T14:41:31.031+05:30 [ERR] cbgt index creation failed: manager_api: could not create index, indexDefs.ImplVersion: “NS41LjA=” > mgr.version: 5.5.0 – base.(*CbgtContext).StartManager() at dcp_sharded.go:304
2020-07-22T14:41:31.031+05:30 [ERR] Error opening database db: manager_api: could not create index, indexDefs.ImplVersion: “NS41LjA=” > mgr.version: 5.5.0 – rest.RunServer() at config.go:1028

We have created channels with smaller number of documents based on document property “TYPE”.

“sync”: function (doc, oldDoc) { channel(doc.TYPE ); }

It is creating channels with name as doc.TYPE. However after making these changes, when we restart Couchbase sync gateway we get different and incorrect counts of document in configured channels every time. We are getting this issue even when channel size is very small and have less than 15 documents. For example we have 12 docs as TYPE TestType however we are getting only 3 documents in TestType channel.
We have created the Couchbase server with 1 node by using cbtransfer command.
We are using windows 10, 16 GB ram and i5 processor. We are using couchbase-server-enterprise_6.5.1 and couchbase-sync-gateway-enterprise_2.7.3_x86_64 for this development.

PFB the updated sync config code.

{
“adminInterface”: “:4985”,
“interface”: “0.0.0.0:4984”,
“log”: [" "],
“databases”: {
“db”: {

“bucket”: “myBucket”,
“username”: “UserName”,
“password”: “**************”,
“enable_shared_bucket_access”: true,
“import_docs”: true,
“num_index_replicas”: 0,
“users”: {
“GUEST”: { “disabled”: false, “admin_channels”: ["
"] }
},
“sync”: `function (doc, oldDoc) {
channel(doc.TYPE );

  }`
}

}

@Chandra_Garg You have already posted this question here . You missed including key details about the errors that you are observing.

Please keep the conversations restricted to a single thread for efficiency and include all relevant details when you post a question so we are not chasing after the wrong problem.

@Teodor_Dimitrov Have you upgraded your Sync Gateway or Couchbase Server version prior to seeing this error? If so, can you share the before/after versions of both?

We are using couchbase-server-enterprise_6.5.1 and couchbase-sync-gateway-enterprise_2.7.3_x86_64 for this development.

Hi all. I’ve managed to fix this some time ago by deleting few documents:

_sync:cfgindexDefs
_sync:cfgnodeDefs-known
_sync:cfgnodeDefs-wanted
_sync:cfgplanPIndexes
_sync:cfgversion

After starting the syncgateway all of the docs were recreated and the error - gone