I am developing for a new application and trying to replicate the changes from cb_lite to cb_server through sync_gateway, but _replicate
endpoint is unsuccessful. I have my cb_server at http://172.20.21.11:8091
This is my sync_gateway
config file:
{
"interface":":4984",
"adminInterface":"0.0.0.0:4985",
"log":["REST"],
"databases":{
"sync_gateway":{
"server":"http://172.20.21.11:8091",
"sync":`function(doc) {channel(doc.channels);}`
}
}
}
successfully running sync_gateway
at http://172.20.21.10:4984
I am also using couchbase_lite_local for this POC Demo, so after downloading the .jar
file, I can kick off the REST api by running java -jar couchbase-lite-local.jar
, so I have cb_lite running at http://172.20.21.10:5984
I have then created a few documents through cb_lite API, so I can retrieve them by going to http://172.20.21.10:5984/sync_gateway/_all_docs
{
"offset": 0,
"total_rows": 2,
"rows": [
{
"id": "126ae767-a78d-449e-8fb6-1e5449c34f3e",
"value": {
"rev": "1-f14eb3706bfafd3762f007defc5367f0",
"_conflicts": []
},
"key": "126ae767-a78d-449e-8fb6-1e5449c34f3e"
},
{
"id": "d6a72266-c2c7-4df3-8904-b323457a7068",
"value": {
"rev": "1-952026746a3efd5ae6cb2ce92116ba14",
"_conflicts": []
},
"key": "d6a72266-c2c7-4df3-8904-b323457a7068"
}
]
}
Now I like to _replicate
these documents to the cb_server, so I am running a POST
request to http://172.20.21.10:5984/_replicate
with the following body:
{
"create_target" : true,
"source" : "http://172.20.21.10:4984/sync_gateway/",
"target" : "sync_gateway"
}
The data doesn’t get synced to cb_server. Here is the log I see in cb_lite after request:
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: Listener: authHeader is null
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: Listener: Unauthorized -- requestCredentials not given or do not match allowed credentials
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger e
SEVERE: RemoteRequest: Got error status: 404 for org.apache.http.client.methods.HttpGet@6a290e04. Reason: Not Found
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: Sync: Puller@7c5a1774[http://172.20.21.10:4984/sync_gateway/]: starting ChangeTracker with since=null
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: Sync: Puller@7c5a1774[http://172.20.21.10:4984/sync_gateway/]: started ChangeTracker com.couchbase.lite.replicator.ChangeTracker@47a2449b
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: Sync: Puller@7c5a1774[http://172.20.21.10:4984/sync_gateway/]: Received invalid doc ID from _changes: {seq=1, id=_user/GUEST, changes=[]}
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: ChangeTracker: com.couchbase.lite.replicator.ChangeTracker@47a2449b: Change tracker calling stop (OneShot)
Nov 05, 2014 2:10:15 AM com.couchbase.lite.util.SystemLogger w
WARNING: Sync: Puller@7c5a1774[http://172.20.21.10:4984/sync_gateway/]: ChangeTracker com.couchbase.lite.replicator.ChangeTracker@47a2449b stopped
Any guru out there knows what’s missing from this workflow? I am stuck pushing the changes from cb_lite to the cb_server and vice verse.