Couchbasecloud sync_gateway weird behaviour

38 views
Skip to first unread message

jalv...@txmglobal.com

unread,
Feb 28, 2014, 11:34:04 AM2/28/14
to mobile-c...@googlegroups.com
Hi !

Scenario 1 (same config.json leads to different results):
---------------
I created a couchbasecloud sync_gateway named "restaurant" with the following config.json and the GUEST property checked:

{
"interface":":4984",
"adminInterface":":4985",
"log":["REST"],
"databases":{
"restaurant":{
"server":"http://172.16.1.115:8091",
"bucket":"restaurant",
"importDocs":true,
"users": {
"GUEST":{"disabled":false, "admin_channels":["*"]}
}
"sync":`function(doc) {channel(doc.channels);}`
}
}

When I type on a browser: http://sync.couchbasecloud.com/restaurant/ I get prompted to a login page asking for login credentials (which is wrong since I'm telling it to allow Anonymous access).

Next, I created a new sync_gateway named "test_" with the same config.json and GUEST checked.
When I type on a browser: http://sync.couchbasecloud.com/test_/ I get this JSON response instead:

{"committed_update_seq":2,"compact_running":false,"db_name":"test_","disk_format_version":0,"doc_count":0,"instance_start_time":1393544812047648,"purge_seq":0,"update_seq":2}

Why I got different responses if I'm using exactly the same config.json in both cases?

Scenario 2 (After deleting both sync_gateways I still get responses):
---------------
I deleted both sync_gateways from my couchbasecloud dashboard.
When I type http://sync.couchbasecloud.com/restaurant/ and/or http://sync.couchbasecloud.com/test_/ I still get the same responses. I did this on different browsers (IE and Chrome) and I got the same results.
Any ideas?
Is there a "time window" on the couchbasecloud server that maintain sessions for some time after sync_gateways are created even after when you explicitly delete them or change settings?

Thanks in advance!

Regards!
//Javier

J. Chris Anderson

unread,
Mar 1, 2014, 5:37:01 PM3/1/14
to mobile-c...@googlegroups.com

J. Chris Anderson

unread,
Mar 1, 2014, 5:39:28 PM3/1/14
to mobile-c...@googlegroups.com


On Friday, February 28, 2014 8:34:04 AM UTC-8, jalv...@txmglobal.com wrote:
Hi !

Scenario 1 (same config.json leads to different results):
---------------
I created a couchbasecloud sync_gateway named "restaurant" with the following config.json and the GUEST property checked:

{
"interface":":4984",
"adminInterface":":4985",
"log":["REST"],
"databases":{
"restaurant":{
"server":"http://172.16.1.115:8091",
"bucket":"restaurant",
"importDocs":true,
"users": {
"GUEST":{"disabled":false, "admin_channels":["*"]}
}
"sync":`function(doc) {channel(doc.channels);}`
}
}


This doesn't look like valid config JSON, and Couchbase Cloud doesn't let you set the raw JSON, just the Sync Function. Can you describe in more detail what you are doing?

Thanks!
Chris
 

jalv...@txmglobal.com

unread,
Mar 3, 2014, 11:49:24 AM3/3/14
to mobile-c...@googlegroups.com
Hi Chris,

The config.json posted here is the same I used on my local sync_gateway version.
In fact, the FAQ section on couchbasecloud.com shows a config.json very similar to mine (except it uses default values).
If the cloud version of sync_gateway does not support but just the sync function it should have been clearly stated there.

But anyway, do you know why I'm getting different results using exactly the same config.json?

Regards!
//Javier

J. Chris Anderson

unread,
Mar 4, 2014, 1:28:17 PM3/4/14
to mobile-c...@googlegroups.com
On Monday, March 3, 2014 8:49:24 AM UTC-8, jalv...@txmglobal.com wrote:
Hi Chris,

The config.json posted here is the same I used on my local sync_gateway version.
In fact, the FAQ section on couchbasecloud.com shows a config.json very similar to mine (except it uses default values).
If the cloud version of sync_gateway does not support but just the sync function it should have been clearly stated there.

In your config the sync function should be inside of a particular database, eg under the "restaurants" key. The FAQ has it like this:

{
    "interface":":4984",
    "adminInterface":":4985",
    "log":["REST"],
    "databases":{
    "sync_gateway":{
        "server":"http://localhost:8091",
        "bucket":"sync_gateway",
        "sync":`function(doc) {channel(doc.channels);}`
    }
}
 
Maybe that will help? You have the default sync function in there, so it'll be hard to tell when you've got it right, maybe modify to something like 

function(doc){
  channel("all");
  channel(doc.channels);
}

This way if you have an "all" channel you know its running.
Reply all
Reply to author
Forward
0 new messages