[ https://issues.apache.org/jira/browse/COUCHDB-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ryan Ramage closed COUCHDB-1706. -------------------------------- Resolution: Duplicate Thanks for the report. This has been fixed in COUCHDB-1697. The fix should be applied to the 1.3.x branch. > function_clause error when querying views with cors > --------------------------------------------------- > > Key: COUCHDB-1706 > URL: https://issues.apache.org/jira/browse/COUCHDB-1706 > Project: CouchDB > Issue Type: Bug > Components: HTTP Interface > Reporter: Sander Dijkhuis > > When querying views using the new cross-origin support, CouchDB sometimes > raises a function_clause error instead of returning the results. It doesn’t > do so consistently. For example, if the other-origin webpage makes two > requests after each other, one may work and the other may fail (in any > order). I haven’t seen this error yet when querying views without using cors. > Rebuilding CouchDB, remaking the databases or refreshing the views doesn’t > work and the view itself doesn’t do much that can go wrong: > {code:title=The view} > profiles: { > map: function(doc) { > if (doc.type && doc.type == 'profile') emit(doc.user, null); > } > } > {code} > I’m running CouchDB 1.3 commit 8be3ec0218873fa3516f564678dbd2c74ebb5246 with > build-couchdb commit fabf7c51c8c5b278b72ffe95f12915016f104996. > {code:title=The stacktrace} > [error] [<0.653.0>] function_clause error in HTTP request > [info] [<0.653.0>] Stacktrace: [{string,to_lower, > > > [undefined], > [{file,"string.erl"},{line,468}]}, > > > {couch_httpd_cors,maybe_apply_cors_headers,2, > [{file, > > > > "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd_cors.erl"}, > {line,219}]}, > > > {couch_httpd,send_response,4, > [{file, > > > > "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd.erl"}, > {line,704}]}, > > > {couch_mrview_http,design_doc_view,5, > [{file, > > > > "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couch_mrview/src/couch_mrview_http.erl"}, > {line,147}]}, > > > {couch_httpd_db,do_db_req,2, > [{file, > > > > "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd_db.erl"}, > {line,234}]}, > > > {couch_httpd,handle_request_int,5, > [{file, > > > > "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd.erl"}, > {line,329}]}, > > > {mochiweb_http,headers,5, > [{file, > > > > "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/mochiweb/mochiweb_http.erl"}, > {line,136}]}, > > > {proc_lib,init_p_do_apply,3, > [{file,"proc_lib.erl"},{line,227}]}] > > > [info] [<0.653.0>] 83.255.2.0 - - GET > /lunacy%2Fuser%2Fsander/_design/user/_view/profiles?include_docs=true&key=%22Bot%203%22&reduce=false > 500 > [error] [<0.653.0>] httpd 500 error response: > > > {"error":"unknown_error","reason":"function_clause"} > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira