Some documents stopped syncing after 2/3 Couchbase Server crashed

Summing up a bit. The Sync fn rejected: old={} --> 403 missing channel access most likely was thrown here

if (doc.type === 'typeA') {
    //...
} else if (doc.type === 'typeB') {
  // ...
} else {
if (oldDoc) {
    requireAccess(oldDoc.channels); // <-- here
}
channel(doc.channels)
}

And the solution was to change the code like so:

if (oldDoc && oldDoc.channels) {
    requireAccess(oldDoc.channels);
}
channel(doc.channels)

I can adapt the code like so to log the documents which have an oldDoc but no oldDoc.channels

if (oldDoc && oldDoc.channels) {
    requireAccess(oldDoc.channels);
}
if (oldDoc && !oldDoc.channels) {
    console.error(doc._id);
    console.error("doc:" + JSON.stringify(doc))        
}
channel(doc.channels)

I will need to run this in production as I was never able to reproduce the issue on my end. I might do this over the weekend. By the way would you know if the oldDocis sent from the client (Android device) or is it fetched from Couchbase Server?

Thanks!