Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 64732 invoked from network); 1 Dec 2009 10:35:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Dec 2009 10:35:52 -0000 Received: (qmail 16298 invoked by uid 500); 1 Dec 2009 10:35:50 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 16209 invoked by uid 500); 1 Dec 2009 10:35:50 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 16199 invoked by uid 99); 1 Dec 2009 10:35:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 10:35:50 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [195.85.130.166] (HELO smtp.atwork.nl) (195.85.130.166) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 10:35:47 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.atwork.nl (Postfix) with ESMTP id 7FD7739C267 for ; Tue, 1 Dec 2009 11:35:22 +0100 (CET) Received: from waldo.buyways.nl (atwork-154.r-212.178.116.atwork.nl [212.178.116.154]) by smtp.atwork.nl (Postfix) with ESMTP id D308139C2BE for ; Tue, 1 Dec 2009 11:35:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by waldo.buyways.nl (Postfix) with ESMTP id 8CA0E2C6D27 for ; Tue, 1 Dec 2009 11:35:10 +0100 (CET) Received: from waldo.buyways.nl ([127.0.0.1]) by localhost (waldo.buyways.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gF2dpTAFR-S0 for ; Tue, 1 Dec 2009 11:35:10 +0100 (CET) Received: from [192.168.218.87] (beauregard.buyways.nl [192.168.217.1]) by waldo.buyways.nl (Postfix) with ESMTP id 5D12E2C6D24 for ; Tue, 1 Dec 2009 11:35:10 +0100 (CET) Subject: _show without docid returns 500 instead of 404 From: "Markus Jelsma - Buyways B.V." Reply-To: markus@buyways.nl To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary="=-aJheu2boeaTeoYOjp66R" Organization: Buyways Date: Tue, 01 Dec 2009 11:35:13 +0100 Message-Id: <1259663713.7371.37.camel@zelda.buyways.nl> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-Virus-Scanned: by @Work --=-aJheu2boeaTeoYOjp66R Content-Type: text/plain Content-Transfer-Encoding: 7bit Dear list, 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 '

'+doc.title+'

'+doc.body+'

'; } " } } 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 :

title

body text

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 "

" + doc.title + "

" + doc.body + "

";},null,[object Object],"function (doc, req) { return '

'+doc.title+'

'+doc.body+'

'; } ")@/usr/share/couchdb/server/main.js:388 ("function (doc, req) { return '

'+doc.title+'

'+doc.body +'

'; } ",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">>, <<"

Render Error

JavaScript function raised error: TypeError: doc is null

Stacktrace:

(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

Function source:

function (doc, req) { return
'<h1>'+doc.title+'</h1><p>'+doc.body+'</p>'; }
">>}]}} [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. Regards, --=-aJheu2boeaTeoYOjp66R--