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

S3 object upload request failing for different regions #953

Closed
jbeasley29 opened this issue Jun 5, 2023 · 6 comments
Closed

S3 object upload request failing for different regions #953

jbeasley29 opened this issue Jun 5, 2023 · 6 comments

Comments

@jbeasley29
Copy link

  • 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.

@bernardd
Copy link
Contributor

bernardd commented Jun 9, 2023

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

@jbeasley29
Copy link
Author

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

@bernardd
Copy link
Contributor

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.

@jbeasley29
Copy link
Author

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

@bernardd
Copy link
Contributor

Thanks :)

@bernardd
Copy link
Contributor

This should be resolved in v2.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants