Couchbase Phonegap Plugin. Replication task status.

46 views
Skip to first unread message

Jakub Kowalski

unread,
Sep 1, 2015, 11:29:46 AM9/1/15
to Couchbase Mobile
Hey,

My problem is similar to this: https://github.com/couchbase/couchbase-lite-ios/issues/565 but this issue is closed and maybe I'm doing something wrong.
I want to handle custom session expiration, but when Sync Gateway returns 401, I'm getting "Processed 0/0" task status. 

Everything is based on Phonegap TodoLite example, with difference that I'm using custom session cookie instead of facebook token, so my sync definition looks similar to this:

source : {
     "url": "http://address:4984/my_db",
     "headers" : "SyncGatewaySession=a8s7df69a87s6d9f7a98s766df97a6s"
},
target : "my_db",
continuous : true


I've tried also with original TodoLite example, connecting it to my sync gateway and removing session cookie from database. Result is the same. 401 from sync gateway, auth-challenge handler is not called.

James Nocentini

unread,
Sep 2, 2015, 5:25:49 AM9/2/15
to Couchbase Mobile
Check this example for `/_replicate` endpoint with the custom header. I think headers takes an object and not a string.
Also, how are you testing this endpoint? Are you running a PhoneGap app or using curl/httpie to send the request to the CBLite server?

James

Jakub Kowalski

unread,
Sep 4, 2015, 3:28:38 AM9/4/15
to Couchbase Mobile
I'm sorry, my header is correct. I was writing this post without code in front of my eyes. Sync gateway correctly authenticate the user. I'm testing it on PhoneGap directly. Problem is that I have no feedback, when the session expires. There is no errors in _active_tasks. Also when user is trying to start the replication without valid session, task appears with no errors and status "Processed 0/0" and after few moments, when SG reject authorization, task disappear. I'm never getting error array in tasks.

Jens Alfke

unread,
Sep 4, 2015, 11:18:33 AM9/4/15
to mobile-c...@googlegroups.com

On Sep 4, 2015, at 12:28 AM, Jakub Kowalski <vood...@gmail.com> wrote:

Problem is that I have no feedback, when the session expires. There is no errors in _active_tasks. Also when user is trying to start the replication without valid session, task appears with no errors and status "Processed 0/0" and after few moments, when SG reject authorization, task disappear. I'm never getting error array in tasks.

This sounds like issue #900 which was just reported a few days ago (although I think the bug has been around a long time.)

However, that bug only appears if the pull replication is already running at the time the session expires; if you started a new replication, the 401 error should be propagated.

—Jens

Jakub Kowalski

unread,
Sep 4, 2015, 11:56:20 AM9/4/15
to Couchbase Mobile
I made some experiments today. Push and pull replications not working but in different way. Push task is dissapearing from _active_tasks like I said before, while pull is getting 400 error with some java.lang.Exception in description.

Jens Alfke

unread,
Sep 4, 2015, 12:08:11 PM9/4/15
to mobile-c...@googlegroups.com

> On Sep 4, 2015, at 8:56 AM, Jakub Kowalski <vood...@gmail.com> wrote:
>
> I made some experiments today. Push and pull replications not working but in different way. Push task is dissapearing from _active_tasks like I said before, while pull is getting 400 error with some java.lang.Exception in description.

Wait, a Java exception? I thought you were on iOS — your initial email referred to an issue in the iOS repo.
We have three implementations of Couchbase Lite, so you have to be specific about which one you’re using.

—Jens

Jakub Kowalski

unread,
Sep 4, 2015, 12:16:43 PM9/4/15
to Couchbase Mobile
I'm so sorry. Issue is similar, but I'm developing on android with Phonegap Couchbase Lite Plugin.
Reply all
Reply to author
Forward
0 new messages