Register new couchbase bucket in sync gateway 2.0 through admin rest api gives "no such database"


#1

Hi,

I have deployed a sync gateway and couchbase server through the Azure store installation (BYOL since development/demo machine, not production). This creates two totally empty instances (no problem here).

I setup a bucket and user on the Couchbase server side, the user has full access to the bucket and read-only admin rights, as described in the tutorial (https://developer.couchbase.com/documentation/mobile/2.0/installation/sync-gateway/index.html). However, the tutorial then assumes a very low level (virtual) machine access that I don’t have on my deployment to configure the connection to the bucket. As such I tried creating the database through the rest api (put on /demo). This however gives me the response
{
“error”: “not_found”,
“reason”: “no such database “demo””
}

I am pretty confident in the json, since it is based on the one I used to set-up the same configuration (server + sync gateway) on my local dev machine through docker. You can view the anonymized version hereunder:
{
“server”: “couchbase://couchbase_server_url”,
“bucket”: “demo”,
“username”: “demosync”,
“password”: “password_for_demosync”,
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”,
“users”: {
“GUEST”: {
“disabled”: false,
“admin_channels”: [
“*”
]
}
}
}

Could anybody point me to what I a doing wrong, or give me an alternative solution to setup the database connection on the sync gateway?

I am using sync gateway 2.0 with couchbase server 5.1.1.


#2

This error generally you see if request is not type of PUT. however, you can be double sure of type of request and other things you may wanna try add one forward slash after the database name.

put /demo/

Most important you must use Admin rest API with port 4985.


#3

Thank you, the additional slash solved the issue.

The other points I was certain of (method and port), but I didn’t think to put an additional slash at the end of the url.


#4

I am glad it worked. Marked this post as solution so this thread will be closed.