Skip to content

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Jul 8, 2025

Issue

smithy-lang/smithy-typescript#1643 must be merged and codegen updated before merging this PR.

edit: The above PR is related but not required

Description

When a client uses the default regional AWS endpoint ruleset from our code generator, it should now also receive a config resolver that adds a default provider function for client.config.endpoint().

This is because pre-endpoints-2.0 it was guaranteed that config.endpoint() would exist as a function. This was removed for public AWS SDK clients because we have no way of guaranteeing an endpoint is known without knowing the operation being called, but for internal generated clients this should be retained when using the default regional AWS endpoints, because they are a direct replacement for endpoints.json-based endpoints.

Testing

additionally, protocol test clients qualify as non-public AWS clients, and behave in the same way as described above.

// smithy client (non-AWS), endpoint is required.
const smithy = new SmithyClient({ endpoint: "" });
await smithy.config.endpoint(); // unchecked call

// AWS SDK public client, endpoint is optional, config.endpoint is not guaranteed
const aws = new AwsSdkClient({});
await aws.config.endpoint?.(); // call must be checked.

// AWS non-public client, endpoint is optional but default regional endpoints are applied
const awsInternal = new AwsInternalClient({});
await awsInternal.config.endpoint(); // unchecked call

@kuhe kuhe requested a review from a team as a code owner July 8, 2025 20:40
@kuhe kuhe changed the title fix/regional endpoints resolver fix(codegen): generate default endpoint provider for default regional AWS endpoints Jul 8, 2025
@kuhe kuhe marked this pull request as draft July 8, 2025 20:46
@kuhe kuhe force-pushed the fix/regional-endpoints-resolver branch from 9783f18 to bc630ec Compare July 9, 2025 14:13
@kuhe kuhe force-pushed the fix/regional-endpoints-resolver branch from bc630ec to 961b486 Compare July 9, 2025 14:14
@kuhe kuhe marked this pull request as ready for review July 9, 2025 14:41
@kuhe kuhe merged commit 27a66c0 into aws:main Jul 9, 2025
5 checks passed
@kuhe kuhe deleted the fix/regional-endpoints-resolver branch July 9, 2025 15:05
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants