On Feb 11, 2009, at 1:03 PM, Jan Lehnardt wrote:
On 11 Feb 2009, at 12:55, Wout Mertens wrote:
On Feb 11, 2009, at 12:46 PM, Jan Lehnardt wrote:
On 11 Feb 2009, at 00:22, Wout Mertens wrote:
I'm trying to run the couchdb svn head and I'm not able to create
documents or run the test suite using Futon. I tried both Safari
and Firefox. Troubleshooting further I tried curl:
$ curl -X PUT -d '{"keys": ["param1", "param2", "paramN"]}'
http://localhost:5984/test/foo
{"error":"error","reason":"badarg"}
What Paul said or use POST without `_id`.
You also need `-H "Content-Type: application/json"` at least.
Ok now I tried
$ curl -X POST -H "Content-Type: application/json" -d '{"keys":
["param1", "param2", "paramN"]}' http://localhost:5984/test/foo
{"error":"badmatch","reason":"{\"application/json\",[]}"}
Which gives this at debug level:
[error] [<0.57.0>] Uncaught error in HTTP request: {error,{badmatch,
{"application/json",[]}}}
[debug] [<0.57.0>] Stacktrace: [{mochiweb_multipart,get_boundary,1},
Seems like there's a multipart request going on? Can you add the -v
option?
$ curl -X PUT http://127.0.0.1:5984/test
{"ok":true}
$ curl -vX POST -H "Content-Type: application/json" -d '{"keys":
["param1", "param2", "paramN"]}' http://127.0.0.1:5984/test
* About to connect() to 127.0.0.1 port 5984 (#0)
* Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
> POST /test HTTP/1.1
> User-Agent: curl/7.17.1 (i386-apple-darwin9) libcurl/7.17.1 OpenSSL/
0.9.7l zlib/1.2.3 libidn/1.0
> Host: 127.0.0.1:5984
> Accept: */*
> Content-Type: application/json
> Content-Length: 40
>
< HTTP/1.1 500 Internal Server Error
< Server: CouchDB/0.9.0a743122-incubating (Erlang OTP/R12B)
< Date: Wed, 11 Feb 2009 12:16:45 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 35
< Cache-Control: must-revalidate
<
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0
{"error":"error","reason":"badarg"}
And on the couchdb side:
$ couchdb
sh: line 0: exec: crypto_drv: not found
=INFO REPORT==== 11-Feb-2009::13:16:34 ===
application: crypto
exited: {shutdown,{crypto_app,start,[normal,[]]}}
type: temporary
Apache CouchDB 0.9.0a743122-incubating (LogLevel=debug) is starting.
Configuration Settings ["/local/pkg/etc/couchdb/default.ini",
"/local/pkg/etc/couchdb/local.ini"]:
[couchdb] database_dir="/local/pkg/var/lib/couchdb"
[couchdb] max_dbs_open="100"
[couchdb] max_document_size="4294967296"
[couchdb] util_driver_dir="/local/pkg/lib/couchdb/erlang/lib/
couch-0.9.0a743122-incubating/priv/lib"
[couchdb] view_timeout="5000"
[daemons] db_update_notifier="{couch_db_update_notifier_sup,
start_link, []}"
[daemons] external_manager="{couch_external_manager, start_link, []}"
[daemons] httpd="{couch_httpd, start_link, []}"
[daemons] query_servers="{couch_query_servers, start_link, []}"
[daemons] view_manager="{couch_view, start_link, []}"
[httpd] WWW-Authenticate="Basic realm=\"administrator\""
[httpd] authentication_handler="{couch_httpd,
default_authentication_handler}"
[httpd] bind_address="127.0.0.1"
[httpd] port="5984"
[httpd_db_handlers] _list="{couch_httpd_show, handle_view_list_req}"
[httpd_db_handlers] _show="{couch_httpd_show, handle_doc_show_req}"
[httpd_db_handlers] _temp_view="{couch_httpd_view,
handle_temp_view_req}"
[httpd_db_handlers] _view="{couch_httpd_view, handle_view_req}"
[httpd_global_handlers] /="{couch_httpd_misc_handlers,
handle_welcome_req, <<\"Welcome\">>}"
[httpd_global_handlers] _active_tasks="{couch_httpd_misc_handlers,
handle_task_status_req}"
[httpd_global_handlers] _all_dbs="{couch_httpd_misc_handlers,
handle_all_dbs_req}"
[httpd_global_handlers] _config="{couch_httpd_misc_handlers,
handle_config_req}"
[httpd_global_handlers] _replicate="{couch_httpd_misc_handlers,
handle_replicate_req}"
[httpd_global_handlers] _restart="{couch_httpd_misc_handlers,
handle_restart_req}"
[httpd_global_handlers] _stats="{couch_httpd_misc_handlers,
handle_stats_req}"
[httpd_global_handlers] _utils="{couch_httpd_misc_handlers,
handle_utils_dir_req, \"/local/pkg/share/couchdb/www\"}"
[httpd_global_handlers] _uuids="{couch_httpd_misc_handlers,
handle_uuids_req}"
[httpd_global_handlers] favicon.ico="{couch_httpd_misc_handlers,
handle_favicon_req, \"/local/pkg/share/couchdb/www\"}"
[log] file="/local/pkg/var/log/couchdb/couch.log"
[log] level="debug"
[query_servers] javascript="/local/pkg/bin/couchjs /local/pkg/share/
couchdb/server/main.js"
=INFO REPORT==== 11-Feb-2009::13:16:34 ===
application: crypto
exited: {shutdown,{crypto_app,start,[normal,[]]}}
type: temporary
sh: line 0: exec: crypto_drv: not found
Apache CouchDB has started. Time to relax.
[debug] [<0.57.0>] 'PUT' /test {1,1}
Headers: [{'Accept',"*/*"},
{'Host',"127.0.0.1:5984"},
{'User-Agent',"curl/7.17.1 (i386-apple-darwin9) libcurl/
7.17.1 OpenSSL/0.9.7l zlib/1.2.3 libidn/1.0"}]
[info] [<0.57.0>] 127.0.0.1 - - 'PUT' /test 201
[debug] [<0.59.0>] 'POST' /test {1,1}
Headers: [{'Accept',"*/*"},
{'Content-Length',"40"},
{'Content-Type',"application/json"},
{'Host',"127.0.0.1:5984"},
{'User-Agent',"curl/7.17.1 (i386-apple-darwin9) libcurl/
7.17.1 OpenSSL/0.9.7l zlib/1.2.3 libidn/1.0"}]
[error] [<0.59.0>] Uncaught error in HTTP request: {error,badarg}
[debug] [<0.59.0>] Stacktrace: [{ets,lookup,[crypto_server_table,port]},
{crypto,control,2},
{couch_util,new_uuid,0},
{couch_httpd_db,db_req,2},
{couch_httpd_db,do_db_req,2},
{couch_httpd,handle_request,3},
{mochiweb_http,headers,4},
{proc_lib,init_p,5}]
[debug] [<0.59.0>] HTTPd 500 error response:
{"error":"error","reason":"badarg"}
[info] [<0.59.0>] 127.0.0.1 - - 'POST' /test 500
Still struggling with pkgsrc to get Erlang 12B-5 in there ;)
Wout.