Update: I corrected the below permission issue and I can read the log files dancer generates. There was a small code bug, fixed. So now the logs display nothing, but my POST request still just fails silently! :'(
Update 2 : I fixed it by just giving write permissions to /srv/www/domain.com/MyApp/logs
I have:
- An amazon-ec2 instance with the Amazon Linux AMI.
- It has apache2, running a perl dancer app on cgi as described here.
I have code doing OAuth with github API. Works perfect well on my machine but the final POST fails on amazon.
This may seem like a dev question, but I'm a beginner with linux sysadmin and I want clues as to how I should narrow my problem down.
This is my code:
my $browser = LWP::UserAgent->new;
#alteast from the browser, seems like this POST never happens.
my $resp = $browser->post($github_post_url,
[
client_id => $client_id,
client_secret => $client_secret,
code => $code,
state => $state
]);
die "error while fetching: ", $resp->status_line
unless $resp->is_success;
my %querystr = parse_query_str($resp->decoded_content);
my $acc = $querystr{access_token};
if($acc) {
#code to retrive access token...
redirect $github_auth_success;
return;
}
return redirect "/fail";#<<< THIS HAPPENS
The logs from here (tail /srv/www/domain.com/logs/error.log ) for this app say:
log directory /srv/www/domain.com/MyApp/bin/.. isn't writable/executable and can't chmod it at /usr/local/share/perl5/Dancer/Logger.pm line 16.
But my /bin directory IS writable! And executable for everyone!
- How do I figure what is really happening here? Do I look at some other log somewhere?
- Could amazon-ec2 be blocking the outgoing post? There doesn't seem to be any outbound rule I can set in the security groups?
MyApp
, I set this writable and I got the right error! :S Still can't getting to the botom of why that post doesn't work. – gideon Jan 9 '13 at 14:19LWP::UserAgent
object. Fixed it, and seems the response code isNothing
!? – gideon Jan 9 '13 at 14:24