You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the AWS client is inadvertently created with a nil value for the region, then invoking a resource request will result in a vague {:error, :nxdomain} result.
Example
GIVEN:
The env var AWS_REGION is not set, but AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are.
If the AWS API always requires a region subdomain for these endpoints, it would be helpful if this library had some sort of validation to ensure the presence of client.region and produce a clear error message when it's missing.
The text was updated successfully, but these errors were encountered:
@wyattisimo Thank you for the detailed issue! It's the start of 2025 but I'd argue you probably won 2025's "Best Issue Award" 👍 🥇
The fun of regions and the bungeejumping with that in AWS. It's been a while since I dug deep into this but I believe AWS assumes a default region in some places (so called "global" endpoints) while it's necessary in others. Hence (IIRC) we assume the region to always need to be defined. Lambda is one of those where the region is at least required. (See doc).
I'm more than open to find a "happy place" to provide a more clear error message on the client.region being missing so if you have a decent proposal for a "happy place" I'd be open to accept a PR 👍
If the AWS client is inadvertently created with a
nil
value for the region, then invoking a resource request will result in a vague{:error, :nxdomain}
result.Example
GIVEN:
The env var
AWS_REGION
is not set, butAWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
are.WHEN:
This code is executed:
THEN:
The following error occurs:
Notes
After some investigation, I discovered that the request sent to hackney was specifying the host as:
lambda..amazonaws.com
This malformed host value is built when
parts
contains["lambda", nil, "amazonaws.com"]
in thebuild_final_endpoint
function here:aws-elixir/lib/aws/request.ex
Line 253 in 8e23feb
build_final_endpoint
is called here:aws-elixir/lib/aws/request.ex
Lines 227 to 234 in 8e23feb
Resolution?
If the AWS API always requires a region subdomain for these endpoints, it would be helpful if this library had some sort of validation to ensure the presence of
client.region
and produce a clear error message when it's missing.The text was updated successfully, but these errors were encountered: