Cordova plugin 1.1.0 replication problems - Android


I have switched to 1.1.0 and I am having the following replication problems (which actually were present also in the previous 1.0.4). The same app on iOS works flawlessly, but only with 1.0.4 installed (with 1.1.0 is crashes).

1- I see many of these infos:

W/Listener﹕ authHeader is null
W/Listener﹕ Unauthorized -- requestCredentials not given or do not match allowed credentials

2- many of these errors:

W/Sync﹕ com.couchbase.lite.replicator.PullerInternal@a298339: failed to write {C0EB0388-4130-43EE-9D9C-E9C2B5032145 #1-ed202b9bba0ccb7e1a4076efffc5e854}: status=500
E/Sync﹕ com.couchbase.lite.replicator.PullerInternal@a298339: Progress: set error = org.apache.http.client.HttpResponseException
E/SQLiteDatabase﹕ Error inserting doc_id=431 revid=1-68c79ef9bbb5cdbd53fc22db98f9d8c6 no_attachments=true deleted=false current=true json=[B@50aa6ba
            android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: revs.doc_id, revs.revid (code 2067)

3- several of these:

 W/Sync﹕ com.couchbase.lite.replicator.PullerInternal@a298339 no new remote revisions to fetch.  add lastInboxSequence (1762) to pendingSequences (

As a consequence to all these errors, the database is not properly replicated and some items result missing. One thing to notice is that the missing items are always the same.

I have also upgraded the server to 3.1.0 and sync_gateway to 1.1.0, just to be sure that the problem was not there, but no solution there.

Anybody can suggest what to do?



Hi @lucapale,

Item 1: How do you set credential for replicator from javascript? Sync-Gateway Cookie needs to be set in request header. Please refer Example section of REST API _replicate

Item 2: It seems trying to insert Revision record with same revision ID multiple times. It seems there is bug in CBL Java/Android code.

Item 3: This is not issue. We should use other Logging Level.



My code for replication comes straight from the original ToDoList example and I ave adapted it to my Ionic app.
I have now tried to follow the new tutorial for Ionic ( using my server as a main replication server.
It seems to work fine on both Android and iOS, so I suppose something changed and I did not track it down.
I will try to upgrade my app using the ionic template example.
Thank you for your support.


Hey @lucapale,

If you need to compare any of the Ionic logic to your own JavaScript implementation, you can see all the heavy lifting in this AngularJS wrapper file:

It essentially just wraps the RESTful API into functions. Might help you to figure out the differences between the two replication logics.



Hi. I have moved to ng-couchbase-lite.js functions for the replications, but I am struggling to get the correct replication with Facebook login.
I manage to login into sync_gateway for the replication, since I changed the remote url to :

remote = {
        url : _this.REMOTE_URL
        auth : {facebook : {email :}}

and in the sync_gateway log I see this:

2015-09-24T09:11:53.511+02:00 HTTP:  #016: POST /diveplanapp/_bulk_docs  (as

But after this all the bulk_get are executed as GUEST user:

2015-09-24T09:11:53.647+02:00 HTTP:  #017: POST /diveplanapp/_bulk_get?revs=true&attachments=true

while they should be like this:

2015-09-24T09:11:53.647+02:00 HTTP:  #017: POST /diveplanapp/_bulk_get?revs=true&attachments=true  (as

Any idea of what I should change in the ngCouchbaseLite?
Is there any complete tutorial around for FB Login into CouchBase using REST API?


I have moved this to a separate Topic.


Cross linking to the new topic for reference: