aws / aws/aws-sdk-php

Intermittently getting EndpointDiscoveryException's thrown when attempting to write records to timestream.

Open
#2,940 7 comments 0 reactions 1 assignee Claimed by @stobrien89 View on GitHub
investigating p2
Dominant language
PHP
Stars
6.2k
Forks
1.3k
Avg merge
2h 53m
Merged PRs (30d)
7

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
'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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.