Description
Describe the bug
I have a webhook endpoint that consumes messages from a 3rd party and writes records into AWS Timestream. It does so using the TimestreamWrite/TimestreamWriteClient::writeRecords
method. There are long periods of time in which it works, but intermittently it will start throwing exceptions. When this starts to happen, it seems that ~1/3 of requests fail with this exception, while 2/3 of the requests continue to work.
Here are the exception details:
Property | Value |
---|---|
class | Aws\Exception\AwsException |
awsErrorCode | EndpointDiscoveryException |
awsErrorMessage | The endpoint required for this service is currently unable to be retrieved, and your request can not be fulfilled unless you manually specify an endpoint. |
previous exception | Error executing "DescribeEndpoints" on "https://ingest.timestream.us-west-2.amazonaws.com"; AWS HTTP error: cURL error 6: getaddrinfo() thread failed to start (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://ingest.timestream.us-west-2.amazonaws.com |
Expected Behavior
According to https://curl.se/libcurl/c/libcurl-errors.html the curl error means: Could not resolve host. The given remote host was not resolved.
I expected the records to be written to timestream.
Current Behavior
It appears that in some intermittent cases that the endpoint discovery call doesn't work and the hostname https://ingest.timestream.us-west-2.amazonaws.com
cannot be resolved.
Reproduction Steps
<?php
use Aws\Credentials\Credentials;
use Aws\Exception\AwsException;
use Aws\Result;
use Aws\TimestreamWrite\Exception\TimestreamWriteException;
use Aws\TimestreamWrite\TimestreamWriteClient;
$awsKey = '{{ INSERT AWS KEY }}';
$awsSecret = '{{ INSERT AWS SECRET }}';
$awsTimestreamDatabase = '{{ INSERT TIMESTREAM DB }}';
$awsTimestreamTable = '{{ INSERT TIMESTREAM TABLE }}';
$awsTimestreamRecords = []; //INSERT RECORDS TO BE INSERTED
$client = new TimestreamWriteClient([
'version' => 'latest',
'region' => 'us-west-2',
'credentials' => new Credentials($awsKey, $awsSecret),
]);
// This is what throws the exception intermittently
$response = $client->writeRecords([
'DatabaseName' => $awsTimestreamDatabase,
'Records' => $awsTimestreamRecords,
'TableName' => $awsTimestreamTable,
]);
Possible Solution
I'm guessing there must be some issue with the curl setup here as I doubt that endpoint on aws is having that many issues.
Additional Information/Context
This happens to hundreds, if not thousands of times per day. It does seem to occur when there are more requests being sent at the same time. For example, overnight there are much fewer requests and everything seems to work fine. But during the day when it is getting flooded with requests then about 1/3 of them fail with this exception.
SDK version used
3.311.0
Environment details (Version of PHP (php -v
)? OS name and version, etc.)
PHP 8.3.7, Ubuntu 22.04