Snowplow Mini Quickstart Issue - 401 Unauthorized from curl --user username:password http://< the public ip>/elasticsearch

I’m embarrassed to ask this, but here we go.
I’m trying to get through the Snowplow Mini Quickstart and I’m stuck in 2.3 Testing.

Open up Elasticsearch and check the returned JSON:

curl --user username:password http://< the public ip>/elasticsearch
You should see a 200 OK response

I am getting a 401 response from this.
I’ve tried stopping my instance and changing the username and password in the “View/Change User Data” dialog. I’ve tried this from the command line. I’ve also tried this using Postman with to send a GET with basic authentication. Both give me the same response.

Any help would be greatly appreciated.

-Stew

Hey @StewSchiling - you should never be embarrassed to ask a question on these forums! We’ll take a look at your problem and see if we can help.

Thanks, Alex! I appreciate it.
What information is helpful in troubleshooting? Would the server log files be useful?

Hi @StewSchiling,

To test this I have just spun up a fresh Snowplow Mini instance - however I cannot seem to replicate the issue you are seeing! The only time I seem to be able to get a 401 response is if I do not supply the --user | -u option or if the basic auth values are not set correctly.

If you could please supply:

  1. The AWS Region that you are experiencing the issue within?
  2. The AMI ID you are using?

Does the username and password work as expected if you attempt to navigate to the home page?

http://<your ip>/home/

Sure thing.

AWS instance and region: ec2-18-221-100-138.us-east-2.compute.amazonaws.com
AMI: snowplow-mini-0.3.0-1504094779-hvm-ebs-amd64 (ami-cbdffcae)

I get the 401 response from /home as well (see below)

The user data script looks like this.
#!/bin/bash

iglu_server_super_uid=“abfd48ac-61a1-4dc0-bf68-0c6fc973f905”

domain_name=example.com
tls_cond=“off”

username=“stewartschilling”
password=“simplepassword”

Hi @StewSchiling - just to confirm that you are also pasting the other section of the User Data script in as well?

# DO NOT ALTER BELOW #
#add apiKey to iglu-resolver.json for auth in the iglu server
iglu_resolver_config_dir="/home/ubuntu/snowplow/configs/iglu-resolver.json"
sed -i 's/\(.*"apikey":\)\(.*\)/\1 "'$iglu_server_super_uid'"/' $iglu_resolver_config_dir

#write super apikey to db
export PGPASSWORD=snowplow
iglu_server_setup="INSERT INTO apikeys (uid, vendor_prefix, permission, createdat) VALUES ('${iglu_server_super_uid}','*','super',current_timestamp);"
psql --host=localhost --port=5432 --username=snowplow --dbname=iglu -c "${iglu_server_setup}"

#add domain name to Caddyfile
inserted_line=""
sed -i '1d' /home/ubuntu/snowplow/configs/Caddyfile #delete first line of the default Caddyfile 
if [[ "${tls_cond}" == "on" ]]; then
  inserted_line="$domain_name *:80 { \n        tls example@example.com \n"
else
  inserted_line="*:80 { \n        tls off \n"
fi
sed -i "1s/^/${inserted_line}/" /home/ubuntu/snowplow/configs/Caddyfile

#add username and password to Caddyfile for basic auth
sed -i "s/USERNAME_PLACEHOLDER/$username/g" /home/ubuntu/snowplow/configs/Caddyfile
sed -i "s/PASSWORD_PLACEHOLDER/$password/g" /home/ubuntu/snowplow/configs/Caddyfile
sudo service caddy_init restart

As this is the code that will actually setup your username and password.

Yes, Indeed. The full script is in use. I just didn’t paste the whole thing here.

Hi @StewSchiling. Have now setup a Snowplow Mini using that region and AMI and everything is working as expected following the guide.

Could you please try SSHing to the server and manually running your entire User Data script again on the box?

Instructions for getting the attached user-data script on the box:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-user-data-retrieval

Hi Josh.

I ended up wiping the slate clean and walking through the quickstart steps with a new instance. I’m now getting the expected 200 OK from /elasticsearch

I’m not sure where I went wrong, but I think I’m OK with not knowing for now.

Thanks for the help!
-Stew

1 Like

Hi @StewSchiling,

Glad to hear you got it working! Sometimes starting again is indeed the easiest option.

Cheers,
Josh

Thanks again for your help.

I’ve managed to fumble my way partly through the quickstart but I’m really struggling with the learning curve. I’m going to start a new post on the more general topic of how and where to start.