Replies: 1 comment 1 reply
-
Hi @rifelpet , Thanks for reaching out. What you are describing is the intended behavior. The SDK treats region identifiers as opaque strings and does not strip or validate them. When it encounters an unknown or invalid region string, instead of throwing an error, it defaults to using the AWS partition’s endpoint. This behavior ensures that the SDK remains forward-compatible, allowing new regions to "just work" as they become available without needing to update to the SDK. Thanks, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...
)Describe the bug
The ResolveEndpoint methods on EndpointResolverV2 types claim to return an error if an endpoint is not found:
aws-sdk-go-v2/service/ec2/endpoints.go
Lines 291 to 298 in 5a6b2c0
However this is not the case.
Expected Behavior
An error to be returned if an endpoint is not found
Current Behavior
An endpoint is returned that includes the invalid EndpointParameters values.
Reproduction Steps
While go playground wont run the code in the browser, this can be ran locally to demonstrate that no error is returned:
https://go.dev/play/p/DaFEJcapgvl
Possible Solution
The resolver calls this internal function:
aws-sdk-go-v2/internal/endpoints/awsrulesfn/partition.go
Lines 32 to 56 in 5a6b2c0
which falls back to the default
aws
partition, causing the incorrect endpoint to use theaws
partition's DNS suffix.Additional Information/Context
Being able to determine whether a region is included in the SDK or not is useful to shortcut having to make an API call to ec2.DescribeRegions.
This was possible in the v1 SDK: https://go.dev/play/p/9rp92s-CpXe
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go version go1.22.1 darwin/arm64
Operating System and version
MacOS 14.4.1
Beta Was this translation helpful? Give feedback.
All reactions