I have had issues where passing the POST body via —data didn’t work.

# Create credentials
curl -v --retry 5 --retry-delay 5 -XPOST "http://127.0.0.1:8080/riak-cs/user"; \
     -H "Content-Type: application/json" \
     --data '{"email”:”f...@bar.com", "name”:"foobar”}'

Another way I have tried to do it via curl is:

curl –v -X POST -d @foobar.json "http://127.0.0.1:8080/riak-cs/user"; --header 
"Content–Type:application/json”

Given you are having trouble diagnosing whats getting up there, a good thing to 
do would be increase the verbosity level for curl by doing –vvv.

Been using the above two methods successfully for a while in PROD. One thing to 
note is that I always run it from the server itself.


From: riak-users 
<riak-users-boun...@lists.basho.com<mailto:riak-users-boun...@lists.basho.com>> 
on behalf of Dmitri Zagidulin 
<dzagidu...@basho.com<mailto:dzagidu...@basho.com>>
Date: Wednesday, November 25, 2015 at 8:54 AM
To: Ben Rudolph <brudo...@dimagi.com<mailto:brudo...@dimagi.com>>
Cc: riak-users <riak-users@lists.basho.com<mailto:riak-users@lists.basho.com>>
Subject: Re: Unable to create anonymous user

Ben,

Not sure what to advise. Your configs look ok.
I just downloaded a fresh copy of Riak CS 2.0.1, Stanchion, and a fresh Riak 2.
I set up the configs just as you have (changing only the paths in 
advanced.config to match my machine).
Cutting and pasting your curl line seems to result in correct user creation.
So, the dreaded "Works For Me (tm)".

The only thing I can think of is - double and triple-check all involved 
firewalls.
Searching about for that error message let me to this thread:
http://riak-users.197444.n3.nabble.com/adding-auth-user-not-valid-td4033452.html

Which indicates that the error message can be caused by CS not being able to 
access Stanchion. You mentioned that you can telnet into stanchion_host from 
the riak node. Is Stanchion set to listen to the correct IP and port?

Dmitri







On Wed, Nov 25, 2015 at 10:16 AM, Ben Rudolph 
<brudo...@dimagi.com<mailto:brudo...@dimagi.com>> wrote:
Thanks for the response Dmitri. Just double checked all those settings

1) I checked with stanchion ping and i'm also able to telnet into the 
stanchion_host from the riak node
2)Double checked and it shows up in the logs:
<0.142.0>@riak_cs_config:warnings:120 `anonymous_user_creation` is set as true. 
Set this as false when this CS nodes is populated as public service.
3) Yes
4) Yes

In case useful, here are our configs: 
https://github.com/dimagi/commcarehq-ansible/tree/riak/ansible/roles/riakcs/templates

On Wed, Nov 25, 2015 at 10:04 AM, Dmitri Zagidulin 
<dzagidu...@basho.com<mailto:dzagidu...@basho.com>> wrote:
Hi Ben,

Just to double-check:
1) is Stanchion installed and running, when you try to create the user? (and 
the stanchion_host entry is pointing to it, in cs config?)

2) is anonymous_user_creation = on in the config file?

3) do you have 'buckets.default.allow_mult = true' in the Riak config file?

4) (this is likely to be yes, but just to check) Have you restarted Riak since 
configuring the advanced.config backend?

Dmitri

On Tue, Nov 24, 2015 at 6:40 PM, Ben Rudolph 
<brudo...@dimagi.com<mailto:brudo...@dimagi.com>> wrote:
Hi,

I've almost completed the cluster setup but am running into issues with 
anonymous user creation. All machines ping/pong and their IPs are matching. 
When I run the curl command to create an anonymous user:

curl -H 'Content-Type: application/json' -XPOST http://**:8080/riak-cs/user 
--data '{"email":"em...@email.com<mailto:em...@email.com>", 
"name":"admin_user"}'

And I get an XML response that says Internal Server Error. The console.log file 
looks like this:

2015-11-24 23:16:35.572 [error] <0.439.0> Webmachine error at path 
"/riak-cs/user" : 
{error,{error,{badmatch,{error,malformed_xml}},[{riak_cs_s3_response,xml_error_code,1,[{file,"src/riak_cs_s3_response.erl"},{line,335}]},{riak_cs_s3_response,error_response,1,[{file,"src/riak_cs_s3_response.erl"},{line,249}]},{riak_cs_wm_user,accept_json,2,[{file,"src/riak_cs_wm_user.erl"},{line,119}]},{webmachine_resource,resource_call,3,[{file,"src/webmachine_resource.erl"},{line,186}]},{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},{line,142}]},{webmachine_decision_core,resource_call,...},...]}}
 in riak_cs_s3_response:xml_error_code/1 line 335

Which led me to this issue here<https://github.com/basho/riak_cs/issues/970>. 
However my advanced.config already looks like this (which is what is suggested 
in the issue):
[
 {riak_kv, [
              {add_paths, ["/usr/lib/riak-cs/lib/riak_cs-2.0.1/ebin"]},
              {storage_backend, riak_cs_kv_multi_backend},
              {multi_backend_prefix_list, [{<<"0b:">>, be_blocks}]},
              {multi_backend_default, be_default},
              {multi_backend, [
                  {be_default, riak_kv_eleveldb_backend, [
                      {total_leveldb_mem_percent, 30},
                      {data_root, "/opt/data/riak/leveldb"}
                  ]},
                  {be_blocks, riak_kv_bitcask_backend, [
                      {data_root, "/opt/data/riak/bitcask"}
                  ]}
              ]}
  ]}
].

Any insight would be useful!

Thanks,
Ben

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com<mailto:riak-users@lists.basho.com>
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to