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

AuthenticationFailed - "The Date header in the request is incorrect." #18

Closed
gzzengwei opened this issue May 3, 2021 · 3 comments · Fixed by #20 or #21
Closed

AuthenticationFailed - "The Date header in the request is incorrect." #18

gzzengwei opened this issue May 3, 2021 · 3 comments · Fixed by #20 or #21

Comments

@gzzengwei
Copy link

gzzengwei commented May 3, 2021

Hi

I have it working before like few weeks before and now I had this AuthenticationFailed for all requests.

to re-produce:

mix new my_app

and in mix.exs

  defp deps do
    [
      {:azurex, "~> 0.1.2"}
    ]
  end

and in config/config.exs

config :azurex, Azurex.Blob.Config,
  storage_account_name: System.get_env("AZURE_STORAGE_ACCOUNT"),
  storage_account_key: System.get_env("AZURE_STORAGE_ACCESS_KEY")

and run the code

Azurex.Blob.list_containers 

and I got

{:error,
 %HTTPoison.Response{
   body: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:e5a8dd0f-e01e-000c-17f1-3fd423000000\nTime:2021-05-03T07:57:39.5168256Z</Message><AuthenticationErrorDetail>The Date header in the request is incorrect.</AuthenticationErrorDetail></Error>",
   headers: [
     {"Content-Length", "419"},
     {"Content-Type", "application/xml"},
     {"Server", "Microsoft-HTTPAPI/2.0"},
     {"x-ms-request-id", "e5a8dd0f-e01e-000c-17f1-3fd423000000"},
     {"x-ms-error-code", "AuthenticationFailed"},
     {"Date", "Mon, 03 May 2021 07:57:38 GMT"}
   ],
   request: %HTTPoison.Request{
     body: "",
     headers: [
       {"authorization",
        "SharedKey xxxxxstorage:4nHSO+J19veoXUZRAXIpRbKbVQV2rS2+0wlhACky35Y="},
       {"x-ms-version", "2019-12-12"},
       {"x-ms-date", "Mon, 03 May 2021 07:57:38 Etc/UTC"}
     ],
     method: :get,
     options: [],
     params: %{},
     url: "https://xxxxxstorage.blob.core.windows.net/?comp=list"
   },
   request_url: "https://xxxxxstorage.blob.core.windows.net/?comp=list",
   status_code: 403
 }}

I suspected it's related to Timex as it did work for me before.

@gzzengwei
Copy link
Author

follow up:

I tested the timex version one by one, current azurex@0.1.2 will work with timex@3.7.1 , it breaks from timex@3.7.2

@suranyami
Copy link
Contributor

Slightly better PR #20

@jakobht
Copy link
Owner

jakobht commented May 4, 2021

Thanks for the issue, I see that Timex had at breaking change at 3.7.1 -> 3.7.3, which fits with your investigation, see
https://github.com/bitwalker/timex/blob/master/CHANGELOG.md#potentially-breaking
I hope to look at the PR during today.

jakobht added a commit that referenced this issue May 10, 2021
Addition to Fixes issue #18: timex 3.7 changes meaning of GMT and Etc/GMT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants