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/identity setting global axios defaults #13343

Closed
1 of 5 tasks
pjblakey opened this issue Jan 22, 2021 · 3 comments
Closed
1 of 5 tasks

@azure/identity setting global axios defaults #13343

pjblakey opened this issue Jan 22, 2021 · 3 comments
Assignees
Labels
Azure.Identity 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.
Milestone

Comments

@pjblakey
Copy link

  • Package Name: @azure/identity
  • Package Version: 1.2.2
  • Operating system:
  • nodejs
    • version: 12.20.0
  • browser
    • name/version:
  • [] typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
Use of this package seems to be overriding global axios defaults in consuming code

axios.defaults.validateStatus = () => true is being set in https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/src/client/msalClient.ts#L165. This is set on the global axios instance thus affecting axios calls in our own code, changing the default axios behaviour on error responses

To Reproduce
Steps to reproduce the behavior:

  1. Install @azure/identity package in consuming project
  2. Install axios (v0.21.1) in consuming project
  3. Perform an axios call that returns an error response eg 500
  4. axios unexpectedly doesn't throw the error due to global defaults overriden in @azure/identity

Expected behavior
Use of this package should not override global axios settings in consuming code

Additional context
Suggested fix is to use a custom axios instance in msalClient and set defaults on that rather than the global instance

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 22, 2021
@ramya-rao-a ramya-rao-a added Azure.Identity Client This issue points to a problem in the data-plane of the library. labels Jan 22, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 22, 2021
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jan 22, 2021
@sophiajt
Copy link
Contributor

Thank you for the report. I've filed a fix for this project: #13468. I've also reached out to another dependency which may have a similar issue: AzureAD/microsoft-authentication-library-for-js#2951

@ramya-rao-a ramya-rao-a added this to the [2021] February milestone Jan 29, 2021
@ramya-rao-a ramya-rao-a added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 29, 2021
@sadasant
Copy link
Contributor

sadasant commented Feb 9, 2021

@pjblakey Hello PJ, we've released Identity 1.2.3, in which we've removed all the instances where the global Axios defaults were altered. Can you test again? Please let us know if things are resolved. If so, feel free to close this issue!

Also, please let us know if we can help with anything else!

@sadasant sadasant modified the milestones: [2021] February, [2021] March Feb 9, 2021
@pjblakey
Copy link
Author

@sadasant yep have tested 1.2.3 and the issue's resolved now, thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity 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.
Projects
None yet
Development

No branches or pull requests

4 participants