0
votes

the authentication is based on cookies and it was working with older version of pouchdb (v6). now i am on 7.2.2. Now after syncing started, I can see connection was established with couch but no document gets synced down at all. In my network tab, I can see something like this.

envrionment:

angular 5
chrome
pouchdb 7.2.2

and all the network requests are 200 or 204 with the following response object but local db is empty nor I can see _changes call in the network tab:

{"committed_update_seq":354578181,"compact_running":false,"db_name":"db","disk_format_version":0,"instance_start_time":1595855226634284,"purge_seq":0,"state":"Online","update_seq":354578181}

Looking at the replication events, only paused event is logged (with info being undefined). I am using the following code:

local.replicate
.from(remote, {
  live: true,
  retry: true
}).on('change', function (change) {
  // yo, something changed!
  console.log(11330, ' changes ', change)
}).on('paused', function (info) {
  // replication was paused, usually because of a lost connection
  console.log('paused ', info)
}).on('active', function (info) {
  // replication was resumed
  console.log('active ', info)
}).on('error', function (err) {
  // totally unhandled error (shouldn't happen)
  console.log(1339, err)
});

My remote is defined as:

this.remote = new PouchDB(
  'http://localhost:13765/db',
  {
    fetch: (url, opts) => {
      fetch(url, { ...opts, credentials: "include" });
    }
  },
  {
    skip_setup: true
  }
);

while the local pouch is:

local = new PouchDB("data");

I have tried cache : false when creating the local database but it didn't help

I can't go back to older version of pouch since deployment is not working for certain old libraries but i was hoping the change wouldn't affect syncing.

At once i tried pouchdb-browser and I get this one:

CustomPouchError {stack: "TypeError: Cannot read property 'then' of undefine…ernal:///./node_modules/argsarray/index.js:16:18)", message: "Cannot read property 'then' of undefined", result: {…}}
message: "Cannot read property 'then' of undefined"

while at once pouchdb has a less descriptive error on pause listner

1

1 Answers

0
votes

solved it:

  var db = new PouchDB('remoteurl', {
  fetch: function (url, opts) {
    return PouchDB.fetch(url, opts, { credentials : "include"});
  }
});