2012-12-20 13:31:27.906 [error] <0.30794.1> CRASH REPORT Process <0.30794.1> with 0 neighbours exited with reason: {fitting_exited_abnormally,[{<<"lineno">>,3},{<<"message">>,<<"TypeError: reduce of empty array with no initial value">>},{<<"source">>,<<"unknown">>}]} in gen_fsm:terminate/7 line 611 2012-12-20 13:31:27.912 [error] <0.213.0> Supervisor riak_pipe_builder_sup had child undefined started with {riak_pipe_builder,start_link,undefined} at <0.30794.1> exit with reason {fitting_exited_abnormally,[{<<"lineno">>,3},{<<"message">>,<<"TypeError: reduce of empty array with no initial value">>},{<<"source">>,<<"unknown">>}]} in context child_terminated
Hi, The above is the crash report I get when I run the below script using the api. The api does not return an error. I have to look at the logs on the node running the query else will run till timeout is reached. query.map(''' function(value, keyData, arg) { var data = Riak.mapValuesJson(value)[0]; if(data['adx']=='gdn'){ try{ var matches = data['url'].match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var alt_key = matches && matches[1]; } catch(err){ var alt_key = 'error'; } obj[alt_key] = 1; return [ obj ]; }else{ return []; } }''') query.reduce(''' function(values, arg){ return [ values.reduce( function(acc, item) { for (var state in item) { if (acc[state]) acc[state] += item[state]; else acc[state] = item[state]; } return acc; })]; } ''') Thanks
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com