ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir

Home Page:https://hex.pm/packages/ex_aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

S3 object upload request failing for different regions

jbeasley29 opened this issue · comments

  • Do not use the issues tracker for help or support (try Elixir Forum, Slack, IRC, etc.)
  • Questions about how to contribute are fine.

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.14.4
  • ExAws version mix deps |grep ex_aws: ex_aws 2.4.2
  • HTTP client version. IE for hackney do mix deps | grep hackney: hackney 1.18.1

Current behavior

Include code samples, errors and stacktraces if appropriate.

[csv_file]
|> S3.upload(
  bucket(),
  destination_path
)
|> ExAws.request(region: bucket_region())

After upgrading to version 2.4.2 it appears that ExAws is ignoring the region passed in as a parameter for ExAws.request() in favor of using the default set in the configuration. This results in an error with the message:

<Code>AuthorizationHeaderMalformed</Code>
<Message>The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-east-2'</Message>

When upgrading versions, no changes were made to the way we configure ExAws or how we're performing our requests. If a bucket is in the same region as the default then the request goes through without issue.

Expected behavior

In version 2.4.1 we were able to pass in a region and complete requests. For now, we have rolled back to 2.4.1 but would like to stay up to date on all versions.

I suspect this is a duplicate of #941, unless you think otherwise?

Yes, I believe so. The issues look similar enough that I believe the underlying cause may be the same.

Thanks @jbeasley29 - would you be kind enough to paste your base ex_aws config (ie, the one in /config/config.exs et al) (with appropriate redactions, of course)? I'm trying to get to the bottom of why it's not working exactly the way I think it should.

config :ex_aws,
  access_key_id: [
    {:system, "ACCESS_KEY_ID"},
    {:awscli, "default", 30}
  ],
  secret_access_key: [
    {:system, "SECRET_ACCESS_KEY"},
    {:awscli, "default", 30}
  ]

Thanks :)

This should be resolved in v2.4.3