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

[Azure App Configuration sdk] Running into 401 issue when there is a trailing '/' in store endpoint #25463

Closed
6 tasks
MaryanneNjeri opened this issue Apr 5, 2023 · 11 comments · Fixed by #25624
Closed
6 tasks
Assignees
Labels
App Configuration Azure.ApplicationModel.Configuration bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team

Comments

@MaryanneNjeri
Copy link

MaryanneNjeri commented Apr 5, 2023

  • Package Name: @azure/app-configuration
  • Package Version: 1.3.1
  • Operating system:
  • nodejs
    • version: 16.9.0
  • browser
    • name/version:
  • typescript
    • version: 4.0.2
  • Is the bug related to documentation in

Describe the bug
When using the App configuration client and passing a configuration store endpoint with a trailing '/' and a credential from, am running into a 401 error.

To Reproduce
Steps to reproduce the behavior:

  1. Using the App configuration client, pass a store endpoint with a trailing '/' and a credential.

Expected behavior
The Azure app configuration SDK should handle any trailing '/' in the store endpoint.

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Apr 5, 2023
@xirzec xirzec added bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. App Configuration Azure.ApplicationModel.Configuration labels Apr 6, 2023
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Apr 6, 2023
@xirzec
Copy link
Member

xirzec commented Apr 6, 2023

@minhanh-phan can you take a look?

@HarshaNalluru HarshaNalluru self-assigned this Apr 12, 2023
@HarshaNalluru
Copy link
Member

Hey @MaryanneNjeri,

We've tested the SDK with your case, and it is working fine.
Can you share more details on the error?

@MaryanneNjeri
Copy link
Author

MaryanneNjeri commented Apr 12, 2023

Hey @HarshaNalluru thank you for helping look into this, am using the AppConfigurationClient passing the app configuration store endpoint with a trailing slash something like "https://store-name.azconfig.io/", and a clientSecretCredential and I run into this 401 error, with the response

{
  "name": "RestError",
  "statusCode": 401,
  "request": {
    "streamResponseStatusCodes": {},
    "url": REDACTED, // Censored
    "method": "GET",
    "headers": {
      "_headersMap": {
        "accept": "application/vnd.microsoft.appconfig.kvset+json, application/json, application/problem+json",
        "user-agent": "AzurePipelines.AzureAppConfiguration.Push/5.0.0 azsdk-js-app-configuration/1.3.1 core-http/2.2.4 Node/v16.19.0 OS/(x64-Windows_NT-10.0.22621)",
        "x-ms-client-request-id": "5a0e62c5-d2cb-4d51-8c86-b49a4f338526",
        "authorization": "REDACTED", // 
        "cookie": "REDACTED"
      }
    },
    "withCredentials": false,
    "timeout": 0,
    "requestId": "5a0e62c5-d2cb-4d51-8c86-b49a4f338526"
  },

The error object doesn't also give a lot of information on what the error could be. Expected result is that the SDK would handle any trailing "/" in the store endpoint

@HarshaNalluru
Copy link
Member

HarshaNalluru commented Apr 13, 2023

@MaryanneNjeri
Looks like the error you see is not much informative, would you run the test by enabling logging?
Set "AZURE_LOG_LEVEL=verbose" environmental variable and provide us with the logs, which might be more helpful in understanding the problem.

@MaryanneNjeri
Copy link
Author

@HarshaNalluru also the response headers indicate that

www-authenticate': {
      name: 'www-authenticate',
      value:  Bearer error="invalid_token", error_description="Authorization token failed validation"'

the token is invalid

@HarshaNalluru
Copy link
Member

You said the problem is from the trailing "/" in the description.
Have you tried with an endpoint where there is no trailing "/" to confirm your theory?

The problem is probably from using a wrong credential. Can you verify?

@HarshaNalluru HarshaNalluru added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Apr 20, 2023
@github-actions
Copy link

Hi @MaryanneNjeri. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@MaryanneNjeri
Copy link
Author

MaryanneNjeri commented Apr 21, 2023

@HarshaNalluru Yes without the trailing "/" in the endpoint authentication is successful. This only happens when there is a trailing "/" in the endpoint.

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Apr 21, 2023
@HarshaNalluru HarshaNalluru added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Apr 21, 2023
@HarshaNalluru
Copy link
Member

HarshaNalluru commented Apr 23, 2023

@MaryanneNjeri, good news, I could repro the issue with 1.3.1. Apologies.
And we had been testing with the unreleased 1.4.1 since we assumed there weren't any changes from 1.3.1 -> 1.4.1 impacting this issue.

Though the details may be boring, I'm sharing them here for future context.
The unnoticed fix went in when we migrated @azure/app-configuration to use the new core stack core-v2 for better maintainability and increased performance as part of #20766.

The fix is already in the source code and will be released as part of version 1.4.1, will release it soon.

HarshaNalluru added a commit that referenced this issue Apr 24, 2023
- Releasing 1.4.1
- Update generated code so the version in generated code is
automatically updated
- Fixes #25463, updates changelog
- Update perf package to rely on 1.4.1, updates perf/tsconfig.json to
use the standard one used by other packages too
@HarshaNalluru
Copy link
Member

@MaryanneNjeri, Thanks for reporting.

@azure/app-configuration/v/1.4.1 has bene published to the npm

@MaryanneNjeri
Copy link
Author

@HarshaNalluru Thank you so much, let me try it out

@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
App Configuration Azure.ApplicationModel.Configuration bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants