500 response listing a bucket with 2 keys

Bryan bryan at go-factory.net
Mon Aug 18 19:19:42 EDT 2014


Thanks! That fixed it. We don’t usually use the HTTP API.

Cheers,
Bryan

----

Bryan Hughes
Go Factory

http://www.go-factory.net

Connecting the Internet of Things

On Aug 18, 2014, at 2:00 PM, Sean Cribbs <sean at basho.com> wrote:

> The problem is term_to_binary. I suspect that <<131, 100, 0, ...>> is
> not a valid UTF-8 sequence. Can you use atom_to_binary(Node, utf8)
> instead?
> 
> On Mon, Aug 18, 2014 at 3:29 PM, Bryan <bryan at go-factory.net> wrote:
>> Hi Everyone,
>> 
>> Getting a very interesting 500 error from the Riak HTTP API. I am using Riak
>> 1.4.2:
>> 
>> curl http://localhost:8098/buckets/nodes/keys?keys=true
>> 
>> <html><head><title>500 Internal Server
>> Error</title></head><body><h1>Internal Server Error</h1>The server
>> encountered an error while processing this
>> request:<br><pre>{error,{exit,{ucs,{bad_utf8_character_code}},
>>             [{xmerl_ucs,from_utf8,1,[{file,"xmerl_ucs.erl"},{line,185}]},
>>              {mochijson2,json_encode_string,2,
>>                          [{file,"src/mochijson2.erl"},{line,186}]},
>>              {mochijson2,'-json_encode_array/2-fun-0-',3,
>>                          [{file,"src/mochijson2.erl"},{line,157}]},
>>              {lists,foldl,3,[{file,"lists.erl"},{line,1197}]},
>>              {mochijson2,json_encode_array,2,
>>                          [{file,"src/mochijson2.erl"},{line,159}]},
>>              {mochijson2,'-json_encode_proplist/2-fun-0-',3,
>>                          [{file,"src/mochijson2.erl"},{line,167}]},
>>              {lists,foldl,3,[{file,"lists.erl"},{line,1197}]},
>>              {mochijson2,json_encode_proplist,2,
>> 
>> [{file,"src/mochijson2.erl"},{line,170}]}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine
>> web server</ADDRESS></body></html>
>> 
>> We use the protocol buffer client to get data in. The data in question is a
>> binary string of the nodes name:
>> 
>> term_to_binary(node())
>> 
>> I am able to get them out via the erlang riak client:
>> 
>> riakc_pb_socket:list_keys(S#state.riak_socketpid, <<“nodes”>>)
>> 
>> gives me:
>> 
>> {ok,[<<131,100,0,19,110,117,99,108,101,117,115,45,50,64,
>>       49,50,55,46,48,46,48,46,49>>,
>>     <<131,100,0,17,110,117,99,108,101,117,115,64,49,50,55,
>>       46,48,46,48,46,49>>]}
>> 
>> (nucleus at 127.0.0.1)2>
>> binary_to_term(<<131,100,0,19,110,117,99,108,101,117,115,45,50,64,
>> (nucleus at 127.0.0.1)2>        49,50,55,46,48,46,48,46,49>>).
>> 'nucleus-2 at 127.0.0.1'
>> 
>> I am looking through the console.log, but there is nothing but some bitbask
>> merge messages.
>> 
>> Cheers,
>> Bryan
>> 
>> 
>> ----
>> 
>> Bryan Hughes
>> Go Factory
>> 
>> http://www.go-factory.net
>> 
>> Connecting the Internet of Things
>> 
>> 
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> 
> 
> 
> 
> -- 
> Sean Cribbs <sean at basho.com>
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/





More information about the riak-users mailing list