Hi,
I’m trying to add attachment in Couchbase Lite to a database and replicate it to CouchDB, but it fails. CouchDB says invallid_json with reason garbage_after_value that seems to be true. Here is the log from CouchDB:
[Mon, 04 Jul 2016 14:06:01 GMT] [debug] [<0.16087.0>] ‘POST’ /my_db_aa67909b6f17483ab90efe99f5852490/_revs_diff {1,
1} from “10.42.0.200"
Headers: [{‘Accept’,“multipart/related, application/json”},
{‘Accept-Encoding’,“gzip, deflate”},
{‘Connection’,“Keep-Alive”},
{‘Content-Length’,“130”},
{‘Content-Type’,“application/json”},
{‘Host’,“10.42.0.1:5984”},
{‘User-Agent’,“CouchbaseLite/1.2 (1.2.0/3fa390b596672fa39243cb9f3457c276eb53707b)”}]
[Mon, 04 Jul 2016 14:06:01 GMT] [debug] [<0.16087.0>] OAuth Params: []
[Mon, 04 Jul 2016 14:06:01 GMT] [info] [<0.16087.0>] 10.42.0.200 - - POST /my_db_aa67909b6f17483ab90efe99f5852490/_revs_diff 200
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16091.0>] ‘POST’ /my_db_aa67909b6f17483ab90efe99f5852490/_bulk_docs {1,
1} from “10.42.0.200"
Headers: [{‘Accept’,“multipart/related, application/json”},
{‘Accept-Encoding’,“gzip, deflate”},
{‘Connection’,“Keep-Alive”},
{‘Content-Length’,“296”},
{‘Content-Type’,“application/json”},
{‘Host’,“10.42.0.1:5984”},
{‘User-Agent’,“CouchbaseLite/1.2 (1.2.0/3fa390b596672fa39243cb9f3457c276eb53707b)”}]
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16091.0>] OAuth Params: []
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16090.0>] ‘PUT’ /my_db_aa67909b6f17483ab90efe99f5852490/1467641162858_37cb750b-aaeb-4562-a47c-10ec255a83da?new_edits=false {1,
1} from “10.42.0.200"
Headers: [{‘Accept’,”/”},
{‘Connection’,“Keep-Alive”},
{‘Content-Type’,“multipart/related; boundary=LTn8FIwowbJZs5GP15ifqWfuZlcrQhX6AoM”},
{‘Host’,“10.42.0.1:5984”},
{‘Transfer-Encoding’,“chunked”}]
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16090.0>] OAuth Params: [{“new_edits”,“false”}]
[Mon, 04 Jul 2016 14:06:02 GMT] [info] [<0.16091.0>] 10.42.0.200 - - POST /my_db_aa67909b6f17483ab90efe99f5852490/_bulk_docs 201
[Mon, 04 Jul 2016 14:06:02 GMT] [error] [<0.16090.0>] attempted upload of invalid JSON (set log_level to debug to log it)
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16090.0>] Invalid JSON: {{error,garbage_after_value},
[<<”{"_rev":“2-b1314c55c2ab85a685a6bb7fecfe07c3”,“layer_id”:“1467641162861_0cc68d42-36e9-4c38-87e7-327442747555”,"_attachments":{“image”:{“digest”:“sha1-H/xAix2xpGGRmEoHGhf+uqzoZww=”,“length”:3118398,“follows”:true,“revpos”:2,“content_type”:“image”}},“height”:“4032”,“width”:“3024”,"_revisions":{“start”:2,“ids”:[“b1314c55c2ab85a685a6bb7fecfe07c3”,“74d53f450e539e5f675c0ee883dd67db”]},"_id":“1467641162858_37cb750b-aaeb-4562-a47c-10ec255a83da”}\r\n1096\r\n">>]}
[Mon, 04 Jul 2016 14:06:02 GMT] [info] [<0.16090.0>] 10.42.0.200 - - PUT /my_db_aa67909b6f17483ab90efe99f5852490/1467641162858_37cb750b-aaeb-4562-a47c-10ec255a83da?new_edits=false 400
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16090.0>] httpd 400 error response:
{“error”:“bad_request”,“reason”:“invalid_json”}
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16061.0>] ‘GET’ /my_db_aa67909b6f17483ab90efe99f5852490/_changes?feed=longpoll&limit=50&heartbeat=300000&style=all_docs&since=569 {1,
1} from "10.42.0.200"
Headers: [{‘Connection’,“Keep-Alive”},{‘Host’,“10.42.0.1:5984”}]
[Mon, 04 Jul 2016 14:06:02 GMT] [debug] [<0.16061.0>] OAuth Params: [{“feed”,“longpoll”},
{“limit”,“50”},
{“heartbeat”,“300000”},
{“style”,“all_docs”},
{“since”,“569”}]
[Mon, 04 Jul 2016 14:06:02 GMT] [info] [<0.16061.0>] 10.42.0.200 - - GET /my_db_aa67909b6f17483ab90efe99f5852490/_changes?feed=longpoll&limit=50&heartbeat=300000&style=all_docs&since=569 200
My CouchDB version 1.6.0.
I reproduced the issue with Couchbase Lite 1.2.0 and 1.2.1. Than I returned back to version 1.1.0 and the issue is gone.