1

I am trying to sync a local PouchDB instance with a remote CouchDB instance on Google App Engine.

I have successfully logged in to the remote instance, but I am getting the following error when I try to sync:

replication paused (e.g. user went offline)
pouchdb-6.3.4.min.js:9 GET https://<ipaddress>:6984/pouchnotes/ net::ERR_CONNECTION_RESET

Sync function

PouchNotesObj.prototype.syncnoteset = function (start, end) {
    var start = new Date().getTime();
    document.getElementById("syncbutton").innerHTML = "Syncing...";

    var i, 
    that = this, 

    options = { 
    doc_ids:['1450853987668']   
  };

    if(start){ options.startkey = start; }
    if(end){ options.endkey = end; }

    PouchDB.sync(this.dbname, this.remote, { retry: true })
    .on('change', function (info) {
       console.log('change');
        document.getElementById("syncbutton").innerHTML = "Sync Notes";
    }).on('paused', function () {
       console.log('replication paused (e.g. user went offline)');
        document.getElementById("syncbutton").innerHTML = "Sync Notes";
    }).on('active', function () {
       console.log('replicate resumed (e.g. user went back online)');
        document.getElementById("syncbutton").innerHTML = "Sync Notes";
    }).on('denied', function (info) {
       console.log('a document failed to replicate, e.g. due to permissions');
        document.getElementById("syncbutton").innerHTML = "Sync Notes";
    }).on('complete', function (info) {
      console.log("Sync Complete");
      document.getElementById("syncbutton").innerHTML = "Sync Notes";
      that.viewnoteset();
      that.formobject.reset();    
      that.show(that.formobject.dataset.show);
      that.hide(that.formobject.dataset.hide);
      var end = new Date().getTime();
      console.log("Time Taken - " + (end - start) + " ms");
    }).on('error', function (error) {
      console.log("Sync Error:" + JSON.stringify(error));  
      alert("Sync Error:" + error);
      that.showerror(error);
    });   

}

Edited to add: do I need to set this up? replication job config on Fauxton

Yvonne Aburrow
  • 2,602
  • 1
  • 17
  • 47

1 Answers1

1

It turned out that I had not configured the firewall correctly.

For anyone else who stumbles across this issue: you only need SSH tunnelling to access Fauxton on localhost. You don't need it to access the API.

If you want to access the API via https, the port is 6984 (not 5984), and for a non-Google App Engine server, you need something like Nginx set up to provide a SSL certificate. On Google App Engine, SSL certificates are provided.

But you still need to configure CouchDB to enable SSL.

Thanks to the guys at the CouchDB user mailing list for their input.

Yvonne Aburrow
  • 2,602
  • 1
  • 17
  • 47