You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Marcus <li...@suemnick.com> on 2014/12/06 15:52:28 UTC
Strange "Badarg error in HTTP request" when submitting request object
Hi,
I’m a pleased user working with couchdb 1.6.1 on OSX. Today I came across problems whose cause I don't know.
I’m using CouchDB-Python/0.10 to write on couchdb. When I submit this JSON-Object
{'docs': [{'from': u'+123456789101112', 'text': u'\ufffc', '_attachments': {u'Research Design_2. entwurf.pages': {'data': ‘here are 500kb als base64-encoded data', 'content_type': None}}, 'rowid': 46231, 'date': '2014-11-08T15:04:48', '_id': u'55F950E8-577F-45FB-AE5D-BC552C98F883', 'id': u'55F950E8-577F-45FB-AE5D-BC552C98F883'}]}
I got a 500-Error Message in response. The couchdb-log contains following items
[Sat, 06 Dec 2014 13:44:24 GMT] [error] [<0.2781.0>] Badarg error in HTTP request
[Sat, 06 Dec 2014 13:44:24 GMT] [info] [<0.2781.0>] Stacktrace: [{re,run,
[null,
["^\\s*",
[<<"text/">>,<<".*">>],
"(?:\\s*;.*?)?\\s*",36],
[caseless]],
[]},
{couch_db,'-compressible_att_type/1-fun-0-',
2,
[{file,"couch_db.erl"},{line,972}]},
{lists,any,2,
[{file,"lists.erl"},{line,1223}]},
{couch_db,with_stream,3,
[{file,"couch_db.erl"},{line,991}]},
{couch_db,'-doc_flush_atts/2-lc$^0/1-0-',2,
[{file,"couch_db.erl"},{line,908}]},
{couch_db,doc_flush_atts,2,
[{file,"couch_db.erl"},{line,908}]},
{couch_db,'-update_docs/4-lc$^7/1-7-',2,
[{file,"couch_db.erl"},{line,777}]},
{couch_db,'-update_docs/4-lc$^6/1-6-',2,
[{file,"couch_db.erl"},{line,776}]}]
[Sat, 06 Dec 2014 13:44:24 GMT] [info] [<0.2781.0>] 127.0.0.1 - - POST /my-nice-table/_bulk_docs 500
[Sat, 06 Dec 2014 13:44:24 GMT] [error] [<0.2781.0>] httpd 500 error response:
{"error":"unknown_error","reason":"badarg”}
Other JSOM-objects without an attachment can be successfully submitted to the tabel.
Does anyone have an idea what’s going wrong?
Best Regards
Marcus
Re: Strange "Badarg error in HTTP request" when submitting request object
Posted by Marcus <li...@suemnick.com>.
> On 06 Dec 2014, at 16:08, Alexander Shorin <kx...@gmail.com> wrote:
>
> This isn't valid JSON object, but Python dict representation. Try to
> json.dumps it before send. Also content_type should be string, not
> None.
Oh, the missing content-type was actually a problem oO. Thanks a lot!
> On 06 Dec 2014, at 16:08, Alexander Shorin <kx...@gmail.com> wrote:
> P.S. and why to have two similar id fields?
I didn’t wrote this peace of code so I don’t know the actual intention of this hack. I guess it’s some convenience foo.
Re: Strange "Badarg error in HTTP request" when submitting request object
Posted by Alexander Shorin <kx...@gmail.com>.
On Sat, Dec 6, 2014 at 5:52 PM, Marcus <li...@suemnick.com> wrote:
> {'docs': [{'from': u'+123456789101112', 'text': u'\ufffc', '_attachments': {u'Research Design_2. entwurf.pages': {'data': ‘here are 500kb als base64-encoded data', 'content_type': None}}, 'rowid': 46231, 'date': '2014-11-08T15:04:48', '_id': u'55F950E8-577F-45FB-AE5D-BC552C98F883', 'id': u'55F950E8-577F-45FB-AE5D-BC552C98F883'}]}
This isn't valid JSON object, but Python dict representation. Try to
json.dumps it before send. Also content_type should be string, not
None.
P.S. and why to have two similar id fields?
--
,,,^..^,,,