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

RequestFailedException : Service request failed Status: 401 (Unauthorized) on Docker, WSL2 #429

Closed
DSRAttabotics opened this issue Nov 7, 2020 · 2 comments
Assignees
Labels

Comments

@DSRAttabotics
Copy link

DSRAttabotics commented Nov 7, 2020

Hello!

I'm not sure this is the right place to report this -- I hope it saves time for someone else.

I've been working with App Configuration in a couple of projects, one which went stale for a period. I came back to it to find that the App Config SDK seemingly cannot Build(), failing with a RequestFailedException. The only change I thought I made was switching Docker Desktop to use WSL 2 on the backend, and I've now confirmed this in my testing -- Docker desktop using WSL 2 causes this authentication issue, using HyperV as a back-end runs without issue!!

Steps to repro:

  1. Create a new Azure App Configuration instance, or open existing app Configuration instance.
  2. Copy connection string, paste it in the attached project. appconfigtestproject.zip
  3. Build and Run the attached project using the "appconfigtest" debug profile - verify it runs/exits without exception.
  4. Switch and debug the attached project in it's Docker profile, Unix WSL2 -- it fails with the following auth exception, and details:

Headers:
Server: openresty/1.17.8.2
Date: Sat, 07 Nov 2020 15:15:45 GMT
Connection: keep-alive
WWW-Authenticate: HMAC-SHA256 error="invalid_token", error_description="The access token has expired",Bearer
x-ms-request-id: f74e305d-de1e-4d4f-88b3-3171086ce194

Azure Container instances doesn't seem to have this issue; I've not tried with other containers.

Microsoft.Extensions.Configuration.AzureAppConfiguration v 4.0.0

@zhenlan
Copy link
Contributor

zhenlan commented Nov 9, 2020

error_description="The access token has expired"

According to the error, it's likely the system time in the container is not accurate. The service requires the auth token generated within 15 minutes. See https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-authentication-hmac#errors.

@DSRAttabotics
Copy link
Author

Right - seems like an issue with WSL2 - https://chrislayers.com/2020/01/23/wsl2-docker-and-time/, specifically:

@zhenlan zhenlan closed this as completed Nov 9, 2020
@zhenlan zhenlan self-assigned this Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants