CouchDB同步错误net :: ERR_CONNECTION_RESET

时间:2017-11-28 12:04:00

标签: google-app-engine synchronization couchdb pouchdb

我正在尝试将本地PouchDB实例与Google App Engine上的远程CouchDB实例同步。

我有successfully logged in to the remote instance,但在尝试同步时收到以下错误:

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

同步功能

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);
    });   

}

编辑添加:我需要设置吗? replication job config on Fauxton

1 个答案:

答案 0 :(得分:1)

原来是I had not configured the firewall correctly

对于遇到此问题的其他任何人:您只需要SSH隧道即可访问localhost上的Fauxton。您不需要它来访问API。

如果您想要access the API via https, the port is 6984(而不是5984),对于非Google App Engine服务器,则需要Nginx set up to provide a SSL certificate之类的内容。在Google App Engine上,提供了SSL证书。

但你还需要configure CouchDB to enable SSL

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