Getting an internal error for Amazon Marketplace API requests

I downloaded the Amazon Marketplace SDK and I tried one of the samples in the samples catalog. However, I get an exception with the following details whenever I try it:

Caught Exception: Internal Error Response Status Code: 0 Error Code: Error Type: Request ID: XML: RequestId: , ResponseContext: , Timestamp: ResponseHeaderMetadata: 

I have CURL enabled with SSL. What am I doing wrong?

+7
source share
3 answers

This answer is for future reference. For detailed troubleshooting information, see the comments on the question.

A blank response indicates a failed connection to the Amazon server. In this case, HTTP worked fine, but HTTPS did not. Since turning off CURLOPT_SSL_VERIFYPEER in cURL settings solved the problem, it looks like the Amazon server did not use a valid SSL certificate.

When enabled, CURLOPT_SSL_VERIFYPEER checks to see if the requested host has a valid certificate and allows cURL to return false if it is not. When CURLOPT_SSL_VERIFYPEER turned off, invalid certificates (for example, self-signed) are accepted and a regular response is returned.

+13
source

I had a very similar problem with Amazon. These were sample files bundled with Amazon php api, which contain the following configuration array:

 $config = array ( 'ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3, ); 

and if it is copied and not changed

 'ProxyPort' => -1, 

will lead to an attempt to connect through the proxy -1 port, which, of course, will fail (the problem will be fixed by checking the hanging error). Hope this helps.

+1
source

In future. In the new SDK version, parameters refer to client.php as follows

 private function getDefaultCurlOptions() { return array ( CURLOPT_POST => true, CURLOPT_USERAGENT => $this->config['UserAgent'], CURLOPT_VERBOSE => true, CURLOPT_HEADERFUNCTION => array ($this, 'headerCallback'), CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2 ); } 

customization

 CURLOPT_SSL_VERIFYPEER => false, 

did the trick in my case. However, since I am not a security expert, there are no recommendations from this point of view. At least his job, and you probably don't lose 1 all day, like me.

+1
source

All Articles