couchbaselabs / Couchbase-Lite-PhoneGap-Plugin

Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android
183 stars 67 forks source link

peer-to-peer replication not working #91

Open nandanshanubhag opened 7 years ago

nandanshanubhag commented 7 years ago

Hi @pasin

I'm getting the same problem as #989

The issue seems to be fixed in android but i'm using this phonegap plugin in my ionic app and i'm getting the error

I'm manually typing the IP address of the device to which I'm connecting and replicating, but on the other device I'm getting a 406 and no replication takes place

am I doing anything wrong?

pasin commented 7 years ago

What version of the plugin are you using? and What are two devices that you are syncing?

nandanshanubhag commented 7 years ago

@pasin Thanks for the reply.

i'm using version 1.3.1 and tested on LG Nexus 5 and MI note 4

and i'm using the swagger-client and couchbase lite spec which i found here

i have set the allowed credentials to allowedCredentials = new Credentials("","");

with sync gateway it works properly, but when i try to replicate p2p i don't see any change or any replication happening

i get the following error in my logcat cblite error2

pasin commented 7 years ago

@hideki could this be fixed in 1.4?

hideki commented 7 years ago

@nandanshan, I believe this issue was already fixed with 1.4.x. And our QA tested p2p scenarios between iOS and Android, also between Android and Android. Version 1.4.0 PhoneGap build is not ready yet. So can you manually update Jar files? 1.4-44 is Developer build.

nandanshanubhag commented 7 years ago

@pasin & @hideki,

Thanks for the help. I followed the instructions and the issues is solved. I'm able to sync documents now.

but now,I ran into another issue. The documents which contains images as attachments are not syncing where as documents which do not have attachments are getting synced across peer to peer.

After searching for some time I came to know that the router can't handle multipart data, and the issues is still open

is there any fix for this? or what can be an alternate solution for this?

hideki commented 7 years ago

Hi @nandanshan,

Let me understand better. Are you developing P2P app between Android and Android? or Android and iOS?

hideki commented 7 years ago

Hi @sethrosetter, Does P2P functional test cover P2P with an attachment?

sethrosetter commented 7 years ago

It does not at the moment. We have a ticket to implement them https://github.com/couchbaselabs/mobile-testkit/issues/777

nandanshanubhag commented 7 years ago

Hi @hideki,

I'm currently developing P2P app between Android to Android

As my previous question, is there any solution?

hideki commented 7 years ago

As my previous question, is there any solution?

I don't know any workaround for this issue. We need to reproduce this issue internally first.

hideki commented 7 years ago

The issue is fixed with 1.4.x release. Also our QA verified it. https://github.com/couchbase/couchbase-lite-android/issues/989

hideki commented 7 years ago

@nandanshan

1.4.0 PhoneGap is not released yet.

Please download RC jar files from the following link, and replace the library with the version you are using now. http://files.couchbase.com/maven2/com/couchbase/lite/couchbase-lite-android/1.4-44/ http://files.couchbase.com/maven2/com/couchbase/lite/couchbase-lite-java-core/1.4-44/

raghusarangapani commented 7 years ago

I tested peer to peer replication with and without attachments on the latest 1.4 builds. I used net-mono/SQLite and macosx/SQLite as the clients.

raghusarangapani commented 7 years ago

I re-tested peer to peer replication with attachment between net-mono and android device. Without attachment, replication works fine. With attachment, replication does not work. I see the below trace in the logs:

02-27 15:46:47.456  2492  2534 W Router  : Router unable to route request to do_PUT_Document
02-27 15:46:47.456  2492  2534 W Router  : java.lang.reflect.InvocationTargetException
02-27 15:46:47.456  2492  2534 W Router  :  at java.lang.reflect.Method.invoke(Native Method)
02-27 15:46:47.456  2492  2534 W Router  :  at com.couchbase.lite.router.Router.start(Router.java:560)
02-27 15:46:47.456  2492  2534 W Router  :  at com.couchbase.lite.listener.LiteServlet.service(LiteServlet.java:147)
02-27 15:46:47.456  2492  2534 W Router  :  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
02-27 15:46:47.456  2492  2534 W Router  :  at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2408)
02-27 15:46:47.456  2492  2534 W Router  :  at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2330)
02-27 15:46:47.456  2492  2534 W Router  :  at Acme.Serve.Serve$ServeConnection.run(Serve.java:2110)
02-27 15:46:47.456  2492  2534 W Router  :  at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1238)
02-27 15:46:47.456  2492  2534 W Router  :  at java.lang.Thread.run(Thread.java:761)
02-27 15:46:47.456  2492  2534 W Router  : Caused by: com.couchbase.lite.CouchbaseLiteException, Status: 406 (HTTP 406 not_acceptable)
02-27 15:46:47.456  2492  2534 W Router  :  at com.couchbase.lite.router.Router.getBodyAsDictionary(Router.java:247)
02-27 15:46:47.456  2492  2534 W Router  :  at com.couchbase.lite.router.Router.do_PUT_Document(Router.java:2364)
02-27 15:46:47.456  2492  2534 W Router  :  ... 9 more

It seems like android listener is not handling the multipart request.

hideki commented 7 years ago

@raghusarangapani This is a different issue with https://github.com/couchbase/couchbase-lite-android/issues/989. Could you also file the ticket to couchbase-lite-java-core? Functional test information could help to debug the issue.