Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid AWS Translate service endpoints #2993

Closed
fredericgboutin-yapla opened this issue Aug 30, 2024 · 2 comments
Closed

Invalid AWS Translate service endpoints #2993

fredericgboutin-yapla opened this issue Aug 30, 2024 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@fredericgboutin-yapla
Copy link

fredericgboutin-yapla commented Aug 30, 2024

Describe the bug

This morning our automatic translation logic started reporting errors,

Error executing "TranslateDocument" on "https://translate.ca-central.amazonaws.com/"; AWS HTTP error: cURL error 6: Could not resolve host: translate.ca-central.amazonaws.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://translate.ca-central.amazonaws.com/ 

And sure enough

traceroute translate.ca-central.amazonaws.com
traceroute: unknown host translate.ca-central.amazonaws.com

Looking at the doc - https://docs.aws.amazon.com/general/latest/gr/translate-service.html - the url should be translate.ca-central-1.amazonaws.com and not translate.ca-central.amazonaws.com - aka it is missing the -1

traceroute translate.ca-central-1.amazonaws.com
traceroute: Warning: translate.ca-central-1.amazonaws.com has multiple addresses; using 35.182.104.126
traceroute to translate.ca-central-1.amazonaws.com (35.182.104.126), 64 hops max, 40 byte packets

So this issue is quite critical as ALL AWS Translate methods stopped working.

Expected Behavior

The AWS Translate Client should poke the proper url so it actually works

Current Behavior

The AWS Translate Client currently poke an invalid url so it fails

Reproduction Steps

$client = new \Aws\Translate\TranslateClient([
			'version' => 'latest',
			'region' => 'ca-central-1'
		]);
$client->translateDocument([...]);

Possible Solution

As per the doc - https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.AwsClient.html#method___construct - I tried,

$client = new \Aws\Translate\TranslateClient([
			'version' => 'latest',
			'region' => 'ca-central-1',
			'endpoint' => 'https://translate.ca-central-1.amazonaws.com/',
		]);

But it does NOT work.

You have to pass a full fledge provider,

$client = new \Aws\Translate\TranslateClient([
			'version' => 'latest',
			'region' => 'ca-central-1',
			'endpoint_provider' => fn() => [
				'partition' => 'aws',
				'service' => 'translate',
				'region' => 'ca-central-1',
				'endpoint' => 'https://translate.ca-central-1.amazonaws.com/'
			]
		]);

Additional Information/Context

No response

SDK version used

3.321.0

Environment details (Version of PHP (php -v)? OS name and version, etc.)

8.2

@fredericgboutin-yapla fredericgboutin-yapla added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2024
@fredericgboutin-yapla
Copy link
Author

fredericgboutin-yapla commented Aug 30, 2024

ha god.... somehow the AWS_REGION got truncated so this is a problem on our side 😞

So, if anybody else see this issue, double-verify the region's value.

BTW, when debugging the code I saw that the vendor/aws/aws-sdk-php/src/EndpointDiscovery/EndpointDiscoveryMiddleware.php has some logic to emit a nice message and to retry with the default endpoint upon error with a custom endpoint. I suppose it could have been nice to have something similar when an invalid endpoint URL is generated because of an invalid region.

Anyway... sorry for the noise.

Cheers,

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant