_show without docid returns 500 instead of 404
----------------------------------------------
Key: COUCHDB-598
URL: https://issues.apache.org/jira/browse/COUCHDB-598
Project: CouchDB
Issue Type: Bug
Components: HTTP Interface
Affects Versions: 0.10
Environment: Ubuntu Karmic
Reporter: Markus
Priority: Minor
See also the thread on the mailing
list::http://www.mail-archive.com/[email protected]/msg05633.html and
especially the following quote from Chris Anderson :" The change would be
simple, just remove a catch clause on couch_httpd_show.erl line 81."
Original message below:
------
According to
http://books.couchdb.org/relax/design-documents/shows#Querying%20Show%
20Functions i should receive an HTTP 404 Not Found response, instead i
get a HTTP 500 Internal Server Error. I am unsure as of yet whether i am
doing something wrong or if i should file a bug report for this one.
Here are my two documents in my test database named shows:
{
"_id": "_design/test",
"_rev": "1-21a6d69070ae4bec3e9f14fbb7f93201",
"shows": {
"summary": "function (doc, req) { return
'<h1>'+doc.title+'</h1><p>'+doc.body+'</p>'; } "
}
}
and
{
"_id": "bd108c433aedaa1bd2def0ec85e59a0d",
"_rev": "3-5a031adf97aabe4888b9bfb94ba28d13",
"title": "title",
"body": "body text"
}
I receive proper results using the following HTTP GET request
http://zealand:5984/shows/_design/test/_show/summary/bd108c433aedaa1bd2def0ec85e59a0d
- code : 200
- body : <h1>title</h1><p>body text</p>
Now consider querying the same show function with a non-existing
document id
http://zealand:5984/shows/_design/test/_show/summary/404
- code 500
- body {"error":"normal","reason":"{gen_server,call,\n
[couch_query_servers,\n {ret_proc,{proc,<0.1481.0>,<<
\"javascript\">>,\n
{couch_os_process,prompt},\n
{couch_os_process,set_timeout},\n
{couch_os_process,stop}}}]}"}
Here is the output in the couch.log file:
[Tue, 01 Dec 2009 10:31:37 GMT] [debug] [<0.1594.0>] OAuth Params: []
[Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1726.0>] OS Process ::
function raised error: TypeError: doc is null
[Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1726.0>] OS Process ::
stacktrace: (null,[object Object])@:0
runShow(function (doc, req) {return "<h1>" + doc.title + "</h1><p>" +
doc.body + "</p>";},null,[object Object],"function (doc, req) { return
'<h1>'+doc.title+'</h1><p>'+doc.body+'</p>'; }
")@/usr/share/couchdb/server/main.js:388
("function (doc, req) { return '<h1>'+doc.title+'</h1><p>'+doc.body
+'</p>'; } ",null,[object Object])@/usr/share/couchdb/server/main.js:358
@/usr/share/couchdb/server/main.js:842
[Tue, 01 Dec 2009 10:31:37 GMT] [error] [<0.1594.0>] OS Process Error ::
{render_error,{[{<<"body">>,
<<"<html><body><h1>Render
Error</h1><p>JavaScript function raised error: TypeError: doc is
null</p><h2>Stacktrace:</h2><code><pre>(null,[object Object])@:0
\nrunShow(function (doc, req) {return \"<h1>\" + doc.title +
\"</h1><p>\" + doc.body + \"</p>\";},null,[object
Object],\"function (doc, req) { return '<h1>'+doc.title
+'</h1><p>'+doc.body+'</p>'; }
\")@/usr/share/couchdb/server/main.js:388\n(\"function (doc, req)
{ return '<h1>'+doc.title+'</h1><p>'+doc.body
+'</p>'; } \",null,[object
Object])@/usr/share/couchdb/server/main.js:358
\n@/usr/share/couchdb/server/main.js:842\n</pre></code><h2>Function
source:</h2><code><pre>function (doc, req) { return
'<h1>'+doc.title+'</h1><p>'+doc.body+'</p>'; }
</pre></code></body></html>">>}]}}
[Tue, 01 Dec 2009 10:31:37 GMT] [debug] [<0.1628.0>] Unknown linked
process died: <0.1726.0> (reason: normal)
[Tue, 01 Dec 2009 10:31:37 GMT] [error] [<0.53.0>]
{error_report,<0.24.0>,
{<0.53.0>,supervisor_report,
[{supervisor,{local,couch_secondary_services}},
{errorContext,child_terminated},
{reason,normal},
{offender,[{pid,<0.1628.0>},
{name,query_servers},
{mfa,{couch_query_servers,start_link,[]}},
{restart_type,permanent},
{shutdown,brutal_kill},
{child_type,worker}]}]}}
[Tue, 01 Dec 2009 10:31:37 GMT] [error] [<0.1594.0>] Uncaught error in
HTTP request: {exit,
{normal,
{gen_server,call,
[couch_query_servers,
{ret_proc,
{proc,<0.1726.0>,<<"javascript">>,
{couch_os_process,prompt},
{couch_os_process,set_timeout},
{couch_os_process,stop}}}]}}}
[Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1594.0>] Stacktrace:
[{gen_server,call,2},
{couch_query_servers,ret_os_process,1},
{couch_query_servers,render_doc_show,6},
{couch_httpd_show,'-send_doc_show_response/6-fun-0-',6},
{couch_httpd_db,do_db_req,2},
{couch_httpd,handle_request,5},
{mochiweb_http,headers,5},
{proc_lib,init_p_do_apply,3}]
[Tue, 01 Dec 2009 10:31:37 GMT] [debug] [<0.1594.0>] httpd 500 error
response:
{"error":"normal","reason":"{gen_server,call,\n
[couch_query_servers,\n {ret_proc,{proc,<0.1726.0>,<<
\"javascript\">>,\n
{couch_os_process,prompt},\n
{couch_os_process,set_timeout},\n
{couch_os_process,stop}}}]}"}
[Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1594.0>] 192.168.218.87 - -
'GET' /shows/_design/test/_show/summary/404 50
I am using CouchDB 0.10.0 from Ubuntu Karmic's repository. Any
assistance is much appreciated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.