When you recreate the document, the sync function gets called with the deletion revision (the one with _deleted:true
) as oldDoc
. I think the resulting call to requireAccess(undefined)
is failing. You might try changing the line in the sync function to
if(oldDoc && oldDoc.channels){requireAccess(oldDoc.channels);}