10:23:59.477‖ WARNING: CBL_Pusher[http://sync.dev.appmonkie.com/default]: _bulk_docs got an error: {
error = 500;
id = "account:te...@test.com";
reason = "Exception in JS sync function";
status = 500;
}
From this moment on synchronization doesn't work anymore - with the every push the same error occurs. Only when deleting the local database (mobile device) we can start the replication but then it seems that the remote documents are still there. In a nutshell it seems that the delete function causes a conflict in the database and prevents the changes to be pushed upstream. Looking at the sync gateway logs it seems that the gateway has issue with the channels. My theory is that due to the deletion of the documents the channel is invalidated but I am not sure whether this would cause this error.
Sync Gateway:
19:48:21.848881 HTTP: #2064: POST /default/_bulk_docs (as te...@test.com)
19:48:21.851336 WARNING: Sync fn exception: TypeError; doc = map[owner:te...@test.com _id:account:te...@test.com created_at:2014-11-17T19:48:21.309Z name:Test _revisions:map[ids:[ca9dbffd62a5728a5317ecadbe96c1c6 50b6701430f66b36be95eb866d4d5137] start:%!s(float64=19)] status:new _rev:19-ca9dbffd62a5728a5317ecadbe96c1c6 type:account updated_at:2014-11-17T19:48:21.309Z] -- db.(*Database).getChannelsAndAccess() at crud.go:715
CBLQuery *query = [[OPDatabase getSharedDatabaseInstance].dataBaseInstance createAllDocumentsQuery];
CBLQueryEnumerator *result = [query run:nil];
for (CBLQueryRow *row in result)
{
NSError *error;
NSLog(@"Deleting doc id: %@", row.documentID);
[row.document deleteDocument:&error];
if (error) NSLog(@"Error: %@", error.userInfo);
}