Tim, I'm pretty sure you need to make your query args strings, try query: {
limit: "1" }.
--
Milan
On Jan 31, 2012, at 12:12 PM, Tim Doherty wrote:
> Hello,
>
> I am new to CouchDB, having just inherited a CouchApp project. I have
> successfully replicated the production app to my local CouchDB installation
> (1.1.1 on Windows 7)
>
> I am getting 'Badarg error in HTTP request' on _rewrite requests for views on
> my local machine, while identical requests are fine on the production server,
> i.e.:
>
> This works: production.server.com:5984/arp/_design/arp/_rewrite/emailpresent
>
> But this doesn't: localhost:5984/arp/_design/arp/_rewrite/emailpresent
>
> rewrites.json is as follows:
>
> [
> {
> "from": "/index.html",
> "to":"/index.html"
> },
> {
> "from": "/css/*",
> "to":"/css/*"
> },
> {
> "from": "/images/*",
> "to":"/images/*"
> },
> {
> "from": "/js/*",
> "to":"/js/*"
> },
> {
> "from": "/vendor/*",
> "to":"/vendor/*"
> },
> {
> "from": "/emailpresent",
> "to": "/_view/emailpresent",
> "query": {
> "limit": 1
> }
> },
> {
> "from": "/session/*",
> "to": "/_show/session/*",
> "query": {
> "limit": 1
> }
> },
> {
> "from": "/sessionvalidate",
> "to": "/_show/sessionvalidate",
> "query": {
> "limit": 1
> }
> },
> {
> "from": "/jsdate",
> "to": "/_show/jsdate"
> },
> {
> "from": "/signin",
> "to": "/_view/signin",
> "query": {
> "limit": 1
> }
> },
> {
> "from": "/agentreginfo",
> "to": "/_view/agentreginfo",
> "query": {
> "limit": 1
> }
> },
> {
> "from": "/agentreg/*",
> "to": "/_update/agentreg/*"
> },
> {
> "from": "/vendorreginfo",
> "to": "/_view/vendorreginfo",
> "query": {
> "limit": 1
> }
> },
> {
> "from": "/vendorreg/*",
> "to": "/_update/vendorreg/*"
> },
> {
> "from": "/cancelreg/*",
> "to": "/_update/cancelreg/*"
> },
> {
> "from": "/agentexport/*",
> "to": "/_list/agentexport/agentreginfo/*"
> },
> {
> "from": "/vendorexport/*",
> "to": "/_list/vendorexport/vendorreginfo"
> },
> {
> "from": "/",
> "to": "/index.html"
> }
> ]
>
> And _view/emailpresent/map.js is as follows:
>
> function(doc) {
> if (doc.type == "profile")
> emit(doc.email, "true");
> }
>
> Stack trace from the log is as follows:
>
> [Tue, 31 Jan 2012 17:36:50 GMT] [error] [<0.12525.0>] Badarg error in HTTP
> request
> [Tue, 31 Jan 2012 17:36:50 GMT] [info] [<0.12525.0>] Stacktrace:
> [{erlang,iolist_to_binary,[1]},
> {couch_httpd_rewrite,
> '-maybe_encode_bindings/1-fun-0-',2},
> {lists,foldl,3},
> {couch_httpd_rewrite,handle_rewrite_req,3},
> {couch_httpd_db,do_db_req,2},
> {couch_httpd,handle_request_int,5},
> {mochiweb_http,headers,5},
> {proc_lib,init_p_do_apply,3}]
> [Tue, 31 Jan 2012 17:36:50 GMT] [info] [<0.12525.0>] 127.0.0.1 - - 'GET'
> /arp/_design/arp/_rewrite/emailpresent 500
> [Tue, 31 Jan 2012 17:36:50 GMT] [debug] [<0.12525.0>] httpd 500 error
> response:
> {"error":"unknown_error","reason":"badarg"}
>
> Thanks in advance!
>
> Tim
>