You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Merlyn Albery-Speyer <cu...@gmail.com> on 2009/02/05 07:45:36 UTC

problem PUTting a document with an encoded attachment

Hey there, I'm using 0.8.1 and am working from the examples on the
HTTP_Document_API wiki page. I have what looks to me to be a well
formed PUT request yet couchdb complains. Here's my http request:

PUT pdxjs/content HTTP/1.0
Content-Length: 581
Content-Type: application/json

{
  "_id":"content",
  "_rev":"1170979794",
  "_attachments":
  {
    "tests.html":
    {
      "content_type":"text\/html",
      "data": "PGh0bWw+Cj......"
    }
  }
}

The output I get in the couchdb log is:

[error] [<0.57.0>] {error_report,<0.22.0>,
    {<0.57.0>,crash_report,
     [[{pid,<0.57.0>},
       {registered_name,[]},
       {error_info,
           {error,function_clause,
               [{mochiweb,new_request,
                    [{#Port<0.1273>,
                      {'PUT',"pdxjs/content",{1,0}},
                      [{'Content-Length',"581"},
                       {'Content-Type',"application/json"}]}]},
                {mochiweb_http,headers,4},
                {proc_lib,init_p_do_apply,3}]}},
       {initial_call,{mochiweb_socket_server,acceptor_loop,['Argument__1']}},
       {ancestors,[couch_httpd,couch_server_sup,<0.1.0>]},
       {messages,[]},
       {links,[<0.52.0>,#Port<0.1273>]},
       {dictionary,[]},
       {trap_exit,false},
       {status,running},
       {heap_size,377},
       {stack_size,23},
       {reductions,423}],
      []]}}
[error] [<0.52.0>] {error_report,<0.22.0>,
              {<0.52.0>,std_error,
               {mochiweb_socket_server,235,{child_error,function_clause}}}}

=ERROR REPORT==== 4-Feb-2009::22:24:12 ===
{mochiweb_socket_server,235,{child_error,function_clause}}

What am I missing here?

The document does exist in the pdxjs database:

$ curl http://127.0.0.1:5984/pdxjs/content
{"_id":"content","_rev":"1170979794"}

PUTting a completely new document gives me the same problem. My test
suite passes in Futon. Any help is much appreciated.

Cheers,
Merlyn

Re: [PDX.js] Re: problem PUTting a document with an encoded attachment

Posted by Jesse Hallett <ha...@gmail.com>.
Hmm, trunk you say? I can work on that.

On Wed, Feb 4, 2009 at 11:57 PM, Chris Anderson <jc...@apache.org> wrote:
>
> Merlyn,
>
> I think pdxjs should start following trunk. I'm ready to help with the
> install if there's any trouble.
>
> Much of the wiki and many of the examples are designed to run against
> what will soon be the 0.9 release. But that may not be for a few
> weeks.
>
> Chris
>
> On Wed, Feb 4, 2009 at 10:45 PM, Merlyn Albery-Speyer
> <cu...@gmail.com> wrote:
>> Hey there, I'm using 0.8.1 and am working from the examples on the
>> HTTP_Document_API wiki page. I have what looks to me to be a well
>> formed PUT request yet couchdb complains. Here's my http request:
>>
>> PUT pdxjs/content HTTP/1.0
>> Content-Length: 581
>> Content-Type: application/json
>>
>> {
>>  "_id":"content",
>>  "_rev":"1170979794",
>>  "_attachments":
>>  {
>>    "tests.html":
>>    {
>>      "content_type":"text\/html",
>>      "data": "PGh0bWw+Cj......"
>>    }
>>  }
>> }
>>
>> The output I get in the couchdb log is:
>>
>> [error] [<0.57.0>] {error_report,<0.22.0>,
>>    {<0.57.0>,crash_report,
>>     [[{pid,<0.57.0>},
>>       {registered_name,[]},
>>       {error_info,
>>           {error,function_clause,
>>               [{mochiweb,new_request,
>>                    [{#Port<0.1273>,
>>                      {'PUT',"pdxjs/content",{1,0}},
>>                      [{'Content-Length',"581"},
>>                       {'Content-Type',"application/json"}]}]},
>>                {mochiweb_http,headers,4},
>>                {proc_lib,init_p_do_apply,3}]}},
>>       {initial_call,{mochiweb_socket_server,acceptor_loop,['Argument__1']}},
>>       {ancestors,[couch_httpd,couch_server_sup,<0.1.0>]},
>>       {messages,[]},
>>       {links,[<0.52.0>,#Port<0.1273>]},
>>       {dictionary,[]},
>>       {trap_exit,false},
>>       {status,running},
>>       {heap_size,377},
>>       {stack_size,23},
>>       {reductions,423}],
>>      []]}}
>> [error] [<0.52.0>] {error_report,<0.22.0>,
>>              {<0.52.0>,std_error,
>>               {mochiweb_socket_server,235,{child_error,function_clause}}}}
>>
>> =ERROR REPORT==== 4-Feb-2009::22:24:12 ===
>> {mochiweb_socket_server,235,{child_error,function_clause}}
>>
>> What am I missing here?
>>
>> The document does exist in the pdxjs database:
>>
>> $ curl http://127.0.0.1:5984/pdxjs/content
>> {"_id":"content","_rev":"1170979794"}
>>
>> PUTting a completely new document gives me the same problem. My test
>> suite passes in Futon. Any help is much appreciated.
>>
>> Cheers,
>> Merlyn
>>
>
>
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "Portland JavaScript Admirers" group.
> To post to this group, send email to pdxjs@googlegroups.com
> To unsubscribe from this group, send email to pdxjs+unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/pdxjs?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>

Re: problem PUTting a document with an encoded attachment

Posted by Chris Anderson <jc...@apache.org>.
Merlyn,

I think pdxjs should start following trunk. I'm ready to help with the
install if there's any trouble.

Much of the wiki and many of the examples are designed to run against
what will soon be the 0.9 release. But that may not be for a few
weeks.

Chris

On Wed, Feb 4, 2009 at 10:45 PM, Merlyn Albery-Speyer
<cu...@gmail.com> wrote:
> Hey there, I'm using 0.8.1 and am working from the examples on the
> HTTP_Document_API wiki page. I have what looks to me to be a well
> formed PUT request yet couchdb complains. Here's my http request:
>
> PUT pdxjs/content HTTP/1.0
> Content-Length: 581
> Content-Type: application/json
>
> {
>  "_id":"content",
>  "_rev":"1170979794",
>  "_attachments":
>  {
>    "tests.html":
>    {
>      "content_type":"text\/html",
>      "data": "PGh0bWw+Cj......"
>    }
>  }
> }
>
> The output I get in the couchdb log is:
>
> [error] [<0.57.0>] {error_report,<0.22.0>,
>    {<0.57.0>,crash_report,
>     [[{pid,<0.57.0>},
>       {registered_name,[]},
>       {error_info,
>           {error,function_clause,
>               [{mochiweb,new_request,
>                    [{#Port<0.1273>,
>                      {'PUT',"pdxjs/content",{1,0}},
>                      [{'Content-Length',"581"},
>                       {'Content-Type',"application/json"}]}]},
>                {mochiweb_http,headers,4},
>                {proc_lib,init_p_do_apply,3}]}},
>       {initial_call,{mochiweb_socket_server,acceptor_loop,['Argument__1']}},
>       {ancestors,[couch_httpd,couch_server_sup,<0.1.0>]},
>       {messages,[]},
>       {links,[<0.52.0>,#Port<0.1273>]},
>       {dictionary,[]},
>       {trap_exit,false},
>       {status,running},
>       {heap_size,377},
>       {stack_size,23},
>       {reductions,423}],
>      []]}}
> [error] [<0.52.0>] {error_report,<0.22.0>,
>              {<0.52.0>,std_error,
>               {mochiweb_socket_server,235,{child_error,function_clause}}}}
>
> =ERROR REPORT==== 4-Feb-2009::22:24:12 ===
> {mochiweb_socket_server,235,{child_error,function_clause}}
>
> What am I missing here?
>
> The document does exist in the pdxjs database:
>
> $ curl http://127.0.0.1:5984/pdxjs/content
> {"_id":"content","_rev":"1170979794"}
>
> PUTting a completely new document gives me the same problem. My test
> suite passes in Futon. Any help is much appreciated.
>
> Cheers,
> Merlyn
>



-- 
Chris Anderson
http://jchris.mfdz.com

Re: problem PUTting a document with an encoded attachment

Posted by Merlyn Albery-Speyer <cu...@gmail.com>.
Yes. That was it. Thanks Jan.

On Thu, Feb 5, 2009 at 1:35 AM, Jan Lehnardt <ja...@apache.org> wrote:
>> PUT pdxjs/content HTTP/1.0
..
>> What am I missing here?
>
> A slash?
>
> Cheers
> Jan
> --
>

Re: problem PUTting a document with an encoded attachment

Posted by Merlyn Albery-Speyer <cu...@gmail.com>.
Sigh. Yes, that was it. That sort of works now in 0.8.1 for me. I say
sort of because although I can create documents with attachments that
way I still get HTTP 500's on the couchdb log:

[info] [<0.53.0>] HTTP Error (code 500): {'EXIT',normal}

On Thu, Feb 5, 2009 at 1:35 AM, Jan Lehnardt <ja...@apache.org> wrote:
>> What am I missing here?
>
> A slash?
>
> Cheers
> Jan
> --
>

Re: problem PUTting a document with an encoded attachment

Posted by Jan Lehnardt <ja...@apache.org>.
On 5 Feb 2009, at 07:45, Merlyn Albery-Speyer wrote:

> Hey there, I'm using 0.8.1 and am working from the examples on the
> HTTP_Document_API wiki page. I have what looks to me to be a well
> formed PUT request yet couchdb complains. Here's my http request:
>
> PUT pdxjs/content HTTP/1.0
           ^---
>
> [...]
> What am I missing here?

A slash?

Cheers
Jan
--