Sync gateway: Error creating indexes

Hi,
I’m having trouble running the sync gateway service. I’m running Couchbase Community 5.0 and SyncGateway 2.7.1. Couchbase is working on 8091 and I can access from a browser.

2020-03-03T13:05:38.008+01:00 ==== Couchbase Sync Gateway/2.7.1(5;a08bf70) CE ====
2020-03-03T13:05:38.008+01:00 [WRN] Using deprecated config option: "log". Use "logging.console.log_keys" instead. -- rest.(*ServerConfig).deprecatedConfigLoggingFallback.func5() at config.go:763
2020-03-03T13:05:38.008+01:00 [INF] Logging: Console to stderr
2020-03-03T13:05:38.008+01:00 [INF] Logging: Files disabled
2020-03-03T13:05:38.008+01:00 [ERR] No log_file_path property specified in config, and --defaultLogFilePath command line flag was not set. Log files required for product support are not being generated. -- base.(*LoggingConfig).Init.func1() at logging_config.go:62
2020-03-03T13:05:38.008+01:00 [INF] Logging: Console level: info
2020-03-03T13:05:38.008+01:00 [INF] Logging: Console keys: [* HTTP]
2020-03-03T13:05:38.008+01:00 [INF] Logging: Redaction level: none
2020-03-03T13:05:38.008+01:00 [INF] Configured process to allow 5000 open file descriptors
2020-03-03T13:05:38.008+01:00 [INF] Logging stats with frequency: 1m0s
2020-03-03T13:05:38.008+01:00 [INF] Opening db /mydatabase as bucket "TrackingData", pool "default", server <http://localhost:8091>
2020-03-03T13:05:38.008+01:00 [INF] GoCBCustomSGTranscoder Opening Couchbase database TrackingData on <http://localhost:8091> as user "sync_gateway"
2020-03-03T13:05:38.009+01:00 [INF] Auth: Attempting credential authentication http://localhost:8091?http_idle_conn_timeout=90000&http_max_idle_conns=64000&http_max_idle_conns_per_host=256&kv_pool_size=2&n1ql_timeout=75000&operation_tracing=false
2020-03-03T13:05:38.015+01:00 [INF] Successfully opened bucket TrackingData
2020-03-03T13:05:38.028+01:00 [INF] Set query timeouts for bucket TrackingData to cluster:1m15s, bucket:1m15s
2020-03-03T13:05:38.028+01:00 [INF] Initializing indexes with numReplicas: 0...
2020-03-03T13:05:38.146+01:00 [INF] Query: Index sg_access_x1 doesn't exist, creating...
2020-03-03T13:05:38.149+01:00 [WRN] **Error creating index sg_access_x1: Error creating index with statement:** CREATE INDEX `sg_access_x1` ON `TrackingData`(ALL (ARRAY (op.name) FOR op IN OBJECT_PAIRS(meta().xattrs._sync.access) END)) with {"retain_deleted_xattr":true,"defer_build":true}.  Error: [3000] Expression not indexable: array (`op`.`name`) for `op` in object_pairs((((meta().`xattrs`).`_sync`).`access`)) end - at ) - will retry. -- db.(*SGIndex).createIfNeeded.func1() at indexes.go:256

My sync_gateway.json looks like this:

{
  "log": ["*"],
  "databases": {
    "mydatabase": {
      "server": "http://localhost:8091",
      "bucket": "TrackingData",
      "username": "sync_gateway",
      "password": "password",
      "enable_shared_bucket_access": true,
      "import_docs": true,
      "num_index_replicas": 0,
      "users": {
        "GUEST": { "disabled": false, "admin_channels": ["*"] }
      },
      "sync": `function (doc, oldDoc) {
        if (doc.sdk) {
          channel(doc.sdk);
        }
      }`
    }
  }
}

Running Sync Gateway with GSI requires at least Couchbase Server 5.5

https://docs.couchbase.com/sync-gateway/current/upgrade.html
https://docs.couchbase.com/sync-gateway/current/compatibility-matrix.html

You can disable GSI by specifying "use_views": true in your SG config, or you can upgrade Couchbase Server to 5.5 or above.