Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.amazonalexa.com:443

Tags:

php

curl

alexa

I've been trying to get the Skill Management API working and this morning I've hit a new roadblock without haven't changed anything. I was getting a "User has not consented to this operation error last night" and without changing anything this morning, this is the curl log I'm getting:

Trying to hit the API with the same code as last night and now I'm getting:

string(513) "
* Hostname api.amazonalexa.com was found in DNS cache
* Trying 54.239.28.187...
* TCP_NODELAY set
* Connected to api.amazonalexa.com (54.239.28.187) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.amazonalexa.com:443
* stopped the pause stream! * Closing connection 0 "

Here is the code I'm using:

ob_start();  
$out = fopen('php://output', 'w');

// exchange the access token for list of skills
$c = curl_init('https://api.amazonalexa.com/v0/skills/');
curl_setopt($c, CURLOPT_HTTPHEADER, array(
  'Authorization: ' . $access_token,
  'Accept: application/json',
  'Content-Type: application/x-www-form-urlencoded;charset=UTF-8'
));
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_VERBOSE, true);
curl_setopt($c, CURLOPT_STDERR, $out);
curl_setopt($c, CURLOPT_POST, 1);

$r = curl_exec($c);
curl_close($c);
fclose($out);
$debug = ob_get_clean();
var_dump($r);
echo "<BR><BR>";
var_dump($debug);
$d = json_decode($r);

$r in this case produces bool(false) and $d outputs NULL. I host my server on Godaddy if that makes a difference. I am still able to access Login with Amazon and retrieve an access token. So, it doesn't seem like a hosting problem.

like image 992
Optimus Avatar asked Sep 25 '17 10:09

Optimus


1 Answers

As per the error trace, your connection has an SSL error. The most obvious reason to it that your hosted endpoint either does not have a valid HTTPS certificate or your HTTPS configuration is not right. This can be easily tested if you somehow can hit your endpoint through a browser or a through a curl request.

like image 98
Juned Ahsan Avatar answered Oct 23 '22 14:10

Juned Ahsan