Replicate Couchbase Lite Local using REST API POST to _replicate hangs


#1

I have Couchbase Lite running using the couchbase-lite-local.jar so I can interact withe CBL using the REST API.

java -jar couchbase-lite-local.jar

I am able to create a database, and POST documents to it (using Python requests module).

#create db
resp = requests.put('http://localhost:5984/pizza', auth=('2974f70d-a653-4d9a-9e28-bc2b622ce0cf', '3525695d-a95b-497d-9c95-a33f57348c86'))

#add doc
doc = {"size": "large", "name" : "hawaiian"}
heads =  {'Content-Type': 'application/json'}

resp = requests.post('http://localhost:5984/pizza', data=json.dumps(doc), headers=heads, auth=('2974f70d-a653-4d9a-9e28-bc2b622ce0cf', '3525695d-a95b-497d-9c95-a33f57348c86'))

#so far no problems

I also have Sync Gateway running on a Server. I enabled GUEST access. I verify this is working by opening up the URL http://0.0.0.0:4985/_admin/db/sync_gateway (note: I substituted 0.0.0.0 for the real public IP). Also, if I paste http://0.0.0.0:4985/sync_gateway/ into a browser, it returns a JSON document:

{"committed_update_seq":2,"compact_running":false,"db_name":"sync_gateway","disk_format_version":0,"instance_start_time":1423607026783340,"purge_seq":0,"update_seq":2}

So it looks good. However, if I POST to _replicate on my CBL, it hangs forever until a timeout.

doc = {"source" : "pizza", "target" : "http://0.0.0.0:4984/sync_gateway"}

heads =  {'Content-Type': 'application/json'}

resp = requests.post('http://localhost:5984/_replicate', data=json.dumps(doc), headers=heads, auth=('2974f70d-a653-4d9a-9e28-bc2b622ce0cf', '3525695d-a95b-497d-9c95-a33f57348c86'))

I also tried posting to :4985 and it hangs with no response. Any ideas?

Thank you!


#2

FYI, I was able to run Apache CouchDB on my client machine, and send the same “/_replicate” command to it’s REST API and it syncs to my Sync Gateway without issue. I assume there is something wrong with the couchbase-lite-local.jar wrapper (see https://github.com/couchbaselabs/couchbase-lite-local) or the syntax is slightly off and not documented correctly.


#3

I have the same problem, and report on github:


but no response.