couchdbpouchdbhtml5-appcacheapplication-cache

Data not syncing between CouchDB and PouchDB


I'm attempting to build a basic app with PouchDB on the client and CouchDB on the server with two-way replication.

On the client I have:

db = new PouchDB('mydb');
.
.
.
sync = db.sync('mydb', 'http://localhost:5984/mydb', {
  live: true,
  retry: true
}); // .on() calls left out for brevity, but they are in the code and they are firing

I have a CouchDB server running at the url specified. curling the url provides the expected response. However, no data on the PouchDB is being "pushed" to the server CouchDB. The expected events are firing, but no data is being persisted to the server. On "change" events, I get the following info:

doc_write_failures: 0
docs: Array[0]
docs_read: 0
docs_written: 0
errors: Array[0]

At the moment, there are two docs in the PouchDB database I am attempting to sync with CouchDB. Adding new data to the PouchDB does not trigger syncing.

Any thoughts? I'm stumped...

Edit

When I change the sync() call to the following:

sync = db.sync('http://localhost:5984/mydb', ...)

I get the following error in the js console:

http://localhost:5984/mydb/?_nonce=1437507025317 net::ERR_FAILED

Solution

  • The problem, as it turns out, is that I was using the appcache api, and my manifest file didn't reference the server db in the network section.

    Similar question here.