Hi I have just test my apps without NODEJS (NODEJS in front of sync gateway 
as proxy) ,and I can sync attachments now!
but I want to know why I added NODEJS as proxy cause this issue. My NODEJS 
is so simple as(deploy on the same machine with Sync Gateway):

var http = require('http'), httpProxy = require('http-proxy');

var proxy = httpProxy.createProxyServer({});



var server = require('http').createServer(function(req, res) {
    var url = req.url;
    var host = req.headers.host;
    proxy.web(req, res, { target: 'http://localhost:4984' });
});
server.listen(80);


I do need the NODEJS for some business logic control for web apps.

On Thursday, July 9, 2015 at 9:55:48 AM UTC+8, atom992 wrote:
>
>
>
> On Thursday, July 9, 2015 at 3:40:29 AM UTC+8, James Nocentini wrote:
>>
>> So the ToDoLite PhoneGap 
>>> <https://github.com/couchbaselabs/todolite-phonegap> app isn't pulling 
>>> attachments (photos in this case) correctly?
>>
>>
>>
> I tested again, ToDoLite PhoneGap 
> <https://github.com/couchbaselabs/todolite-phonegap> app can pulling and 
> pushing attachments if I using simple sync function such as:
>
> function(doc) {channel(doc.channels);}
>
> It works fine. but If I add more complicated sync function, the issue 
> appeared.
> I am not sure what cause the issue, complicated sync function,or complicated 
> env(I add nodejs in front of sync gateway as proxy). I will do more test. 
> Thank you.
>
>  
>
>> James
>>
>> On Tuesday, 7 July 2015 18:00:11 UTC+2, atom992 wrote:
>>>
>>>
>>>
>>> On Tuesday, July 7, 2015 at 10:44:42 PM UTC+8, James Nocentini wrote:
>>>>
>>>> Ok thanks, can you post a sample project on github with the issue you 
>>>>> are seeing?
>>>>
>>>>
>>>>
>>> It is base on ToDoLite demo with sync gateway 1.1 on my local env.
>>>  
>>>
>>>> James
>>>>
>>>> On Tuesday, 7 July 2015 16:39:44 UTC+2, atom992 wrote:
>>>>>
>>>>> I am using REST API to query data. and when I query the doc which 
>>>>> should be include  attachment, I found the rev of the doc in CBL is 
>>>>> different than SyncGateway without conflict.
>>>>>
>>>>> On Tuesday, July 7, 2015 at 8:59:37 PM UTC+8, PRASANNA KUMAR wrote:
>>>>>>
>>>>>> Can you post your code for getting the attachment from the CBL database?
>>>>>>
>>>>>>
>>>>>> Attachment attachmentFirstImage = 
>>>>>> document.getCurrentRevision().getAttachment("abc.png");
>>>>>>
>>>>>>
>>>>>> If you want to show in imageview than convert the attachment to bitmap
>>>>>>
>>>>>>
>>>>>> On Monday, July 6, 2015 at 8:00:24 PM UTC+5:30, James Nocentini wrote:
>>>>>>>
>>>>>>> From the logs, I'm not sure what might be causing the issue.
>>>>>>>
>>>>>>> What version of CBL Android are you using?
>>>>>>> Can you post your code for getting the attachment from the CBL 
>>>>>>> database?
>>>>>>>
>>>>>>> Saving an attachment on a document creates a new revision. So CBL 
>>>>>>> Android would be pulling the new revision and attachment. It's probably 
>>>>>>> worth checking with a breakpoint that you're getting the latest 
>>>>>>> revision 
>>>>>>> from CBL as well.
>>>>>>>
>>>>>>> James
>>>>>>>
>>>>>>> On Monday, 6 July 2015 13:54:35 UTC+2, atom992 wrote:
>>>>>>>>
>>>>>>>>     I am testing attachment sync between SyncGateway(1.1) and 
>>>>>>>> CBL(1.1) on Android(5.0.1) emulator using REST API, I can sync 
>>>>>>>> attachment 
>>>>>>>> from CBL to SG, but when I try to sync attachment  from SyncGateway  
>>>>>>>> to 
>>>>>>>> CBL, I found the completed_change_count of ActiveTasks really  add 
>>>>>>>> 1,but I 
>>>>>>>> can not find the attachment that should be sync to CBL.
>>>>>>>>     I found the following logs:
>>>>>>>>
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: /readValue. 
>>>>>>>>  fullBody: {results=[{seq=80, 
>>>>>>>> id=MSG:64598a8e-b613-4026-8b68-4471d65d0bcd, 
>>>>>>>> changes=[{rev=4-d1da30c8ac590e7875df9823475e3074}]}], last_seq=80}
>>>>>>>> D/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: 
>>>>>>>> changeTrackerReceivedChange: {seq=80, 
>>>>>>>> id=MSG:64598a8e-b613-4026-8b68-4471d65d0bcd, 
>>>>>>>> changes=[{rev=4-d1da30c8ac590e7875df9823475e3074}]}
>>>>>>>> D/Sync    (20024): changeTrackerReceivedChange: {seq=80, 
>>>>>>>> id=MSG:64598a8e-b613-4026-8b68-4471d65d0bcd, 
>>>>>>>> changes=[{rev=4-d1da30c8ac590e7875df9823475e3074}]}
>>>>>>>> D/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: adding rev to 
>>>>>>>> inbox 
>>>>>>>> {MSG:64598a8e-b613-4026-8b68-4471d65d0bcd 
>>>>>>>> #4-d1da30c8ac590e7875df9823475e3074}
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: 
>>>>>>>> changeTrackerReceivedChange() incrementing changesCount by 1
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: Incrementing 
>>>>>>>> changesCount count from 37 by adding 1 -> 38
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: addToInbox() 
>>>>>>>> called, 
>>>>>>>> rev: {MSG:64598a8e-b613-4026-8b68-4471d65d0bcd 
>>>>>>>> #4-d1da30c8ac590e7875df9823475e3074}.  Thread: Thread[ChangeTracker-
>>>>>>>> http://X.X.X.X/sgdb/,5,TJWS threads]
>>>>>>>> V/CBLite  (20024): setPaused: false
>>>>>>>> D/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: 
>>>>>>>> /changeTrackerReceivedChange: {seq=80, 
>>>>>>>> id=MSG:64598a8e-b613-4026-8b68-4471d65d0bcd, 
>>>>>>>> changes=[{rev=4-d1da30c8ac590e7875df9823475e3074}]}
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: responseOK: true
>>>>>>>> D/Sync    (20024): changeTrackerCaughtUp
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: Starting new 
>>>>>>>> longpoll
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: Making request 
>>>>>>>> to 
>>>>>>>> http://X.X.X.X/sgdb/_changes
>>>>>>>> V/Sync    (20024): *** 
>>>>>>>> com.couchbase.lite.replicator.ReplicationInternal$2@b649f0f: BEGIN 
>>>>>>>> processInbox (1 sequences)
>>>>>>>> D/Sync    (20024): processInbox called
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: fetching 1 
>>>>>>>> remote 
>>>>>>>> revisions...
>>>>>>>> D/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: 
>>>>>>>> pullRemoteRevision 
>>>>>>>> with rev: {MSG:64598a8e-b613-4026-8b68-4471d65d0bcd 
>>>>>>>> #4-d1da30c8ac590e7875df9823475e3074}
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.support.RemoteRequestRetry@5885628: 
>>>>>>>> RemoteRequestRetry 
>>>>>>>> created, url: 
>>>>>>>> http://X.X.X.X/sgdb/MSG%3A64598a8e-b613-4026-8b68-4471d65d0bcd?rev=4-d1da30c8ac590e7875df9823475e3074&revs=true&attachments=true
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest@303d0f41: 
>>>>>>>> RemoteRequest created, url: 
>>>>>>>> http://X.X.X.X/sgdb/MSG%3A64598a8e-b613-4026-8b68-4471d65d0bcd?rev=4-d1da30c8ac590e7875df9823475e3074&revs=true&attachments=true
>>>>>>>> D/Sync    (20024): [fireTrigger()] => RESUME
>>>>>>>> V/CBLite  (20024): setPaused: false
>>>>>>>> V/Sync    (20024): *** 
>>>>>>>> com.couchbase.lite.replicator.ReplicationInternal$2@b649f0f: END 
>>>>>>>> processInbox (lastSequence=77)
>>>>>>>> D/Sync    (20024): firing trigger: RESUME
>>>>>>>> V/Sync    (20024): [onExit()] IDLE => RUNNING
>>>>>>>> D/Sync    (20024): State transition: IDLE -> RUNNING (via RESUME). 
>>>>>>>>  this: com.couchbase.lite.replicator.PullerInternal@39200f0e
>>>>>>>> D/Sync    (20024): [PullerInternal.waitForPendingFutures()] STARTED 
>>>>>>>> - thread id: 383
>>>>>>>> E/RemoteRequest(20024): 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest@303d0f41: 
>>>>>>>> executeRequest() Exception:
>>>>>>>> E/RemoteRequest(20024): java.lang.NullPointerException: Attempt to 
>>>>>>>> invoke virtual method 'boolean 
>>>>>>>> java.lang.String.startsWith(java.lang.String)' on a null object 
>>>>>>>> reference
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> com.couchbase.lite.support.MultipartDocumentReader.setHeaders(MultipartDocumentReader.java:70)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest.executeRequest(RemoteMultipartDownloaderRequest.java:95)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest.run(RemoteMultipartDownloaderRequest.java:48)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:237)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
>>>>>>>> E/RemoteRequest(20024): at 
>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
>>>>>>>> E/RemoteRequest(20024): at java.lang.Thread.run(Thread.java:818)
>>>>>>>> D/Sync    (20024): 
>>>>>>>> com.couchbase.lite.support.RemoteRequestRetry$1@c20acd4: 
>>>>>>>> RemoteRequestRetry 
>>>>>>>> inner request finished, url: 
>>>>>>>> http://X.X.X.X/sgdb/MSG%3A64598a8e-b613-4026-8b68-4471d65d0bcd?rev=4-d1da30c8ac590e7875df9823475e3074&revs=true&attachments=true
>>>>>>>> D/Sync    (20024): 
>>>>>>>> com.couchbase.lite.support.RemoteRequestRetry@5885628: 
>>>>>>>> isTransientError 
>>>>>>>> called, httpResponse: 
>>>>>>>> org.apache.http.message.BasicHttpResponse@1e8a5e7d e: 
>>>>>>>> java.lang.NullPointerException: Attempt to invoke virtual method 
>>>>>>>> 'boolean 
>>>>>>>> java.lang.String.startsWith(java.lang.String)' on a null object 
>>>>>>>> reference
>>>>>>>> D/Sync    (20024): %s: return false
>>>>>>>> D/Sync    (20024): 
>>>>>>>> com.couchbase.lite.support.RemoteRequestRetry$1@c20acd4: 
>>>>>>>> RemoteRequestRetry 
>>>>>>>> failed, non-transient error.  NOT retrying. url: 
>>>>>>>> http://X.X.X.X/sgdb/MSG%3A64598a8e-b613-4026-8b68-4471d65d0bcd?rev=4-d1da30c8ac590e7875df9823475e3074&revs=true&attachments=true
>>>>>>>> E/Sync    (20024): Error pulling remote revision
>>>>>>>> E/Sync    (20024): java.lang.NullPointerException: Attempt to 
>>>>>>>> invoke virtual method 'boolean 
>>>>>>>> java.lang.String.startsWith(java.lang.String)' on a null object 
>>>>>>>> reference
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> com.couchbase.lite.support.MultipartDocumentReader.setHeaders(MultipartDocumentReader.java:70)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest.executeRequest(RemoteMultipartDownloaderRequest.java:95)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest.run(RemoteMultipartDownloaderRequest.java:48)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:237)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
>>>>>>>> E/Sync    (20024): at 
>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
>>>>>>>> E/Sync    (20024): at java.lang.Thread.run(Thread.java:818)
>>>>>>>> V/Sync    (20024): 
>>>>>>>> com.couchbase.lite.replicator.PullerInternal@39200f0e: giving up on 
>>>>>>>> {MSG:64598a8e-b613-4026-8b68-4471d65d0bcd 
>>>>>>>> #4-d1da30c8ac590e7875df9823475e3074}: java.lang.NullPointerException: 
>>>>>>>> Attempt to invoke virtual method 'boolean 
>>>>>>>> java.lang.String.startsWith(java.lang.String)' on a null object 
>>>>>>>> reference
>>>>>>>> V/CBLite  (20024): setPaused: false
>>>>>>>> D/RemoteRequest(20024): 
>>>>>>>> com.couchbase.lite.support.RemoteMultipartDownloaderRequest@303d0f41: 
>>>>>>>> executeRequest() finally
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: got response. 
>>>>>>>> status: 
>>>>>>>> HTTP/1.1 200 OK mode: LongPoll
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: 
>>>>>>>> /entity.getContent(). 
>>>>>>>>  mode: LongPoll
>>>>>>>> V/ChangeTracker(20024): 
>>>>>>>> com.couchbase.lite.replicator.ChangeTracker@19153841: readValue
>>>>>>>>
>>>>>>>> Note: I have replace the address and bucket name of sync gateway.
>>>>>>>> id=MSG:64598a8e-b613-4026-8b68-4471d65d0bcd, 
>>>>>>>> changes=[{rev=4-d1da30c8ac590e7875df9823475e3074 this doc and rev is 
>>>>>>>> the attachment doc added from SG.
>>>>>>>>
>>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/689af8ba-6c88-4b25-acee-4a6b64892ccf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to