ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir
https://hex.pm/packages/ex_aws
MIT License
1.29k stars 529 forks source link

The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential. #987

Open azharmalik3 opened 1 year ago

azharmalik3 commented 1 year ago

Environment

Current behavior

Mostly failed to read/upload files but after retrying 3/4 times it works and reads files.

Sample code to read file:

ExAws.S3.get_object("project-assets", "yallo-gjuyq/ealog-jxsyr.png") |> ExAws.request()

Expected behaviour

It should read/write the file on the first attempt.

Error

<Error>
  <Code>AuthorizationHeaderMalformed</Code>
  <Message>The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential.</Message>
  <RequestId>8BNSPWDTRBZ8ZSGG</RequestId>
  <HostId>eYIsLyoStWtle4KHE0lCM/ipmKEwqXNvfe37kwciV5pX5aoRKe9TE0cpARb1Cvw9K7t3YbKvIsY=</HostId>
</Error>
bernardd commented 1 year ago

That's weird. What's your config look like (with keys redacted, obviously)? Because it works fine for plenty of people so there must be something specifically weird in your setup.

azharmalik3 commented 1 year ago

It worked fine before the update to the latest version (2.5.5) and used the same config.

config :ex_aws,
  access_key_id: System.fetch_env!("AWS_ACCESS_KEY_ID"),
  secret_access_key: System.fetch_env!("SECRET_ACCESS_KEY"),
  region: "eu-west-1",
  json_codec: Jason

Then we revert back the version to 2.4.4 and it works.