"404 no such database" with existing bucket

I have set up a bucket on Couchbase Server, and set Sync Gateway to point to it. My config:

{
  "log": ["*"],
  "databases": {
    "db": {
      "server": "http://couchbase-server:8091",
      "bucket": "sayit-engb",
      "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }
    }
  }
}

Making a GET /db/ request:

curl -i -X GET http://localhost:4985/sayit-engb/
HTTP/1.1 404 Not Found
Content-Type: application/json
Server: Couchbase Sync Gateway/1.4.0
Date: Wed, 16 Aug 2017 13:25:24 GMT
Content-Length: 64

{"error":"not_found","reason":"no such database \"sayit-engb\""}# 

SG log output:

2017-08-16T13:23:09.960Z ==== Couchbase Sync Gateway/1.4.0(2;9e18d3e) ====
2017-08-16T13:23:09.960Z requestedSoftFDLimit < currentSoftFdLimit (5000 < 65536) no action needed
2017-08-16T13:23:09.960Z Opening db /db as bucket "sayit-engb", pool "default", server <http://couchbase-server:8091>
2017-08-16T13:23:09.960Z Opening Couchbase database sayit-engb on <http://couchbase-server:8091> as user "sayit-engb"
_time=2017-08-16T13:23:10.002+00:00 _level=INFO _msg= Trying with selected node 0
_time=2017-08-16T13:23:10.003+00:00 _level=INFO _msg= Trying with http://172.18.0.2:8091/pools/default/bucketsStreaming/sayit-engb
_time=2017-08-16T13:23:10.039+00:00 _level=INFO _msg=Got new configuration for bucket sayit-engb
_time=2017-08-16T13:23:10.106+00:00 _level=INFO _msg= Trying with selected node 0
2017-08-16T13:23:10.362Z Cache: Initializing changes cache with options {ChannelCacheOptions:{ChannelCacheMinLength:0 ChannelCacheMaxLength:0 ChannelCacheAge:0s} CachePendingSeqMaxWait:5s CachePendingSeqMaxNum:10000 CacheSkippedSeqMaxWait:1h0m0s}
2017-08-16T13:23:10.363Z Feed: Using TAP feed for bucket: "sayit-engb" (based on feed_type specified in config file
2017-08-16T13:23:10.366Z Using default sync function 'channel(doc.channels)' for database "db"
2017-08-16T13:23:10.373Z Auth: Saved _sync:user:: {"admin_channels":{"*":1},"all_channels":null,"sequence":1,"rolesSince":null}
2017-08-16T13:23:10.374Z     Reset guest user to config
2017-08-16T13:23:10.374Z Starting admin server on :4985
2017-08-16T13:23:10.397Z Starting server on :4984 ...
2017-08-16T13:23:10.410Z Changes+: Notifying that "sayit-engb" changed (keys="{_sync:user:}") count=2
2017-08-16T13:23:10.410Z Cache: Received #1 ("_user/")
2017-08-16T13:23:10.410Z Cache: Initialized cache for channel "*" with options: &{ChannelCacheMinLength:50 ChannelCacheMaxLength:500 ChannelCacheAge:1m0s}
2017-08-16T13:23:10.411Z Cache:     #1 ==> channel "*"
2017-08-16T13:23:10.411Z Changes+: Notifying that "sayit-engb" changed (keys="{*}") count=3
2017-08-16T13:24:00.993Z HTTP:  #001: GET /sayit-engb/  (ADMIN)
2017-08-16T13:24:00.993Z HTTP: #001:     --> 404 no such database "sayit-engb"  (0.4 ms)

From the logs it looks like its connecting to the bucket, so why the 404?

Do I need to create a shadow bucket to connect SG to an existing bucket? If so, I am stuck back with my previous issue.

The Sync Gateway database name is the key in the config file:

{
  ...
  "databases": {
    "db": {
      ...
    }
  }
}

So the http request should be to curl -i -X GET http://localhost:4985/db/. It sounds like the choice of db as the name is causing confusion. Can you let us know what resources you used to get to that config? Pretty sure I wrote that example but can’t remember where it is now… :expressionless:

Aha!! Thanks, yes definitely the source of confusion. The relevant doc was https://github.com/couchbase/docker/tree/master/community/sync-gateway/1.5.0-377