Re: nano multipart.insert with multiple attachments [solved]
Hi Jan, sorry for the bad description. The files on disk where no duplicates but the files array which, in my case comes from an external source, wasn't unique, so the same (disk-) file was used multiple times in the array. Created a gist to show the issue: https://gist.github.com/st-fankl-in/d1628fcf0238167f7535eec9752610dd It looks like as if the error only happens if the duplicated files do not come "last" in the attachments array passed to nano.multipart.insert. When i tried with smaller created images, just 4x4 it did not fail. I guess, the created images didn't differ in that case. Thank you, Stefan 2018-03-12 11:06 GMT+01:00 Jan Lehnardt : > Hi Stefan, > > from your sample code it wasn’t really clear that you could have the same > attachment name as filesystems wouldn’t allow this. > > Of course your `files` array might have included duplicates. > > Fwiw, I tried to reproduce your example and couldn’t get to a point where > I had two attachments of the same constructed from a JS object (because > object keys are deduplicated in JS). > > Could you share your example code that produced the error? I agree that > the error message should be better, but so far we can’t see it. > > Best > Jan > -- > > > On 12. Mar 2018, at 09:22, Stefan Klein wrote: > > > > 2018-03-12 7:03 GMT+01:00 Stefan Klein : > > > >> Hi Couchusers, > >> > >> i am trying to create a document with multiple attachments. > >> 13 images, 1.2MB total. > >> > >> I get a 500 from couchdb 1.7.1 and in the couchdb log i get: > >> > >> [info] [<0.3275.73>] Stacktrace: [{couch_db,write_streamed_attachment, > >> [<0.4494.73>, > >> #Fun,- > 2603], > >> [{file,"couch_db.erl"},{line, > >> 1075}]}, > >> {couch_db,with_stream,3, > >> [{file,"couch_db.erl"},{line, > >> 1034}]}, > >> {couch_db,'-doc_flush_atts/2- > >> lc$^0/1-0-',2, > >> [{file,"couch_db.erl"},{line, > 941}]}, > >> {couch_db,'-doc_flush_atts/2- > >> lc$^0/1-0-',2, > >> [{file,"couch_db.erl"},{line, > 941}]}, > >> {couch_db,doc_flush_atts,2, > >> [{file,"couch_db.erl"},{line, > 941}]}, > >> {couch_db,'-update_docs/4-lc$^ > 7/1-7-',2, > >> [{file,"couch_db.erl"},{line, > 810}]}, > >> {couch_db,'-update_docs/4-lc$^ > 6/1-6-',2, > >> [{file,"couch_db.erl"},{line, > 809}]}, > >> {couch_db,update_docs,4, > >> [{file,"couch_db.erl"},{line, > 809}]}] > >> > >> > >> > > Found the error, the attachment names where not unique. > > A resonable error message would have been nice, though. > > > > regards, > > Stefan > > -- > Professional Support for Apache CouchDB: > https://neighbourhood.ie/couchdb-support/ > >
Re: nano multipart.insert with multiple attachments [solved]
Hi Stefan, from your sample code it wasn’t really clear that you could have the same attachment name as filesystems wouldn’t allow this. Of course your `files` array might have included duplicates. Fwiw, I tried to reproduce your example and couldn’t get to a point where I had two attachments of the same constructed from a JS object (because object keys are deduplicated in JS). Could you share your example code that produced the error? I agree that the error message should be better, but so far we can’t see it. Best Jan -- > On 12. Mar 2018, at 09:22, Stefan Klein wrote: > > 2018-03-12 7:03 GMT+01:00 Stefan Klein : > >> Hi Couchusers, >> >> i am trying to create a document with multiple attachments. >> 13 images, 1.2MB total. >> >> I get a 500 from couchdb 1.7.1 and in the couchdb log i get: >> >> [info] [<0.3275.73>] Stacktrace: [{couch_db,write_streamed_attachment, >> [<0.4494.73>, >> #Fun,-2603], >> [{file,"couch_db.erl"},{line, >> 1075}]}, >> {couch_db,with_stream,3, >> [{file,"couch_db.erl"},{line, >> 1034}]}, >> {couch_db,'-doc_flush_atts/2- >> lc$^0/1-0-',2, >> [{file,"couch_db.erl"},{line,941}]}, >> {couch_db,'-doc_flush_atts/2- >> lc$^0/1-0-',2, >> [{file,"couch_db.erl"},{line,941}]}, >> {couch_db,doc_flush_atts,2, >> [{file,"couch_db.erl"},{line,941}]}, >> {couch_db,'-update_docs/4-lc$^7/1-7-',2, >> [{file,"couch_db.erl"},{line,810}]}, >> {couch_db,'-update_docs/4-lc$^6/1-6-',2, >> [{file,"couch_db.erl"},{line,809}]}, >> {couch_db,update_docs,4, >> [{file,"couch_db.erl"},{line,809}]}] >> >> >> > Found the error, the attachment names where not unique. > A resonable error message would have been nice, though. > > regards, > Stefan -- Professional Support for Apache CouchDB: https://neighbourhood.ie/couchdb-support/
Re: nano multipart.insert with multiple attachments [solved]
2018-03-12 7:03 GMT+01:00 Stefan Klein : > Hi Couchusers, > > i am trying to create a document with multiple attachments. > 13 images, 1.2MB total. > > I get a 500 from couchdb 1.7.1 and in the couchdb log i get: > > [info] [<0.3275.73>] Stacktrace: [{couch_db,write_streamed_attachment, > [<0.4494.73>, >#Fun,-2603], > [{file,"couch_db.erl"},{line, > 1075}]}, > {couch_db,with_stream,3, > [{file,"couch_db.erl"},{line, > 1034}]}, > {couch_db,'-doc_flush_atts/2- > lc$^0/1-0-',2, > [{file,"couch_db.erl"},{line,941}]}, > {couch_db,'-doc_flush_atts/2- > lc$^0/1-0-',2, > [{file,"couch_db.erl"},{line,941}]}, > {couch_db,doc_flush_atts,2, > [{file,"couch_db.erl"},{line,941}]}, > {couch_db,'-update_docs/4-lc$^7/1-7-',2, > [{file,"couch_db.erl"},{line,810}]}, > {couch_db,'-update_docs/4-lc$^6/1-6-',2, > [{file,"couch_db.erl"},{line,809}]}, > {couch_db,update_docs,4, > [{file,"couch_db.erl"},{line,809}]}] > > > Found the error, the attachment names where not unique. A resonable error message would have been nice, though. regards, Stefan
nano multipart.insert with multiple attachments
Hi Couchusers, i am trying to create a document with multiple attachments. 13 images, 1.2MB total. I get a 500 from couchdb 1.7.1 and in the couchdb log i get: [info] [<0.3275.73>] Stacktrace: [{couch_db,write_streamed_attachment, [<0.4494.73>, #Fun,-2603], [{file,"couch_db.erl"},{line,1075}]}, {couch_db,with_stream,3, [{file,"couch_db.erl"},{line,1034}]}, {couch_db,'-doc_flush_atts/2-lc$^0/1-0-',2, [{file,"couch_db.erl"},{line,941}]}, {couch_db,'-doc_flush_atts/2-lc$^0/1-0-',2, [{file,"couch_db.erl"},{line,941}]}, {couch_db,doc_flush_atts,2, [{file,"couch_db.erl"},{line,941}]}, {couch_db,'-update_docs/4-lc$^7/1-7-',2, [{file,"couch_db.erl"},{line,810}]}, {couch_db,'-update_docs/4-lc$^6/1-6-',2, [{file,"couch_db.erl"},{line,809}]}, {couch_db,update_docs,4, [{file,"couch_db.erl"},{line,809}]}] My nodejs code is equivalent to: var images = files.map(function(file) { return { name: file, data: fs.readFileSync(file), content_type: 'image/png' } }); nano.multipart.insert(doc, images, doc._id, function(e, body) { if (!e) { console.log(body); } else { console.log(e); } }); Are 13 Attachments and/or 1.2 MB just to much? Thank you, Stefan