Hello,
I’m having an issue downloading attachments on-demand using the Couchbase Lite mobile framework (iOS, version 1.4.1). Currently I have it set up so that all attachments download automatically via the pull replicator (which works fine), but as some documents have many or large attachments, I want to optimize it so that they are downloaded as needed.
To do this, I’m just calling downloadAttachment:
on the pull replicator with the appropriate attachment fetched from the document. The Progress
object it returns has the completedUnitCount
and totalUnitCount
both at -1, and no progress is made.
I turned on verbose logging and found this:
11:38:01.206‖ ChangeTracker: CBLSocketChangeTracker[0x6080001d8420 data]: Started... <https://xxxx.xxx.xxxxxxxx.xxx/data/_changes?feed=normal&heartbeat=300000&style=all_docs&since=844856:844804&filter=sync_gateway/bychannel>
11:38:01.206‖ ChangeTracker: CBLSocketChangeTracker[0x6080001d8420 data]: Event 1 on <__NSCFInputStream: 0x608000117c40>
11:38:01.325‖ RemoteRequest: CBLAttachmentDownloader[GET https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef]: Got response, status 404
11:38:01.325‖ RemoteRequest: CBLRemoteSession done with CBLAttachmentDownloader[GET https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef]
11:38:01.325‖ RemoteRequest: CBLAttachmentDownloader[GET https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef]: JSON error message is: {"error":"not_found","reason":"unknown URL"}
11:38:01.326‖ CBLAttachmentDownloader[GET https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef]: Got error CBLHTTP[404, "unknown URL", <https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef>]
Looking at the URL, it has the attachment ID twice, so I tried removing one of them, and made a GET request to it, and that returned a 401 so at least it found it.
i.e. Change
https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef
to
https://xxxx.xxx.xxxxxxxx.xxx/data/YmKd0-1ofOmK5x_JbKdqRgNh/BG::50d279db-b070-4a3b-981b-80382c82fa0d?rev=3-0e3578f5de948a920a222d412e8bb0ef
Does anyone know where or how this URL is set? Would this occur in the cloud backend, or is this URL constructed by the Couchbase Lite framework?
Thanks.