Skip to content

[yarn-plugin-ado-auth] Circular Promise #131

@mwasplund

Description

@mwasplund

Describe the bug
When running yarn install using yarn-plugin-ado-auth I am hitting a circular promise. It seems like the root issue is that getToken() is storing the promise from fetchToken() and fetchToken() is assigning the token to the cache and then reading the promise from outside the StreamReport async function which creates a circular reference to the Promise itself.

To Reproduce
Steps to reproduce the behavior:

  1. Import the plugin
  2. Run yarn install
  3. See circular error
Chaining cycle detected for promise #<Promise>
    at TokenCache.fetchToken (S:\repos\CopilotDatasets\.yarn\plugins\yarn-plugin-ado-auth.cjs:543:7)
    at async getNpmAuthenticationHeader (S:\repos\CopilotDatasets\.yarn\plugins\yarn-plugin-ado-auth.cjs:621:69)
    at async t.reduceHook (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:148:3961)
    at async cN (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:693:24535)
    at async Wm (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:693:22035)
    at async C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:693:19711
    at async imt (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:693:19665)
    at async Qw (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:693:21279)
    at async KD.getCandidates (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:695:5264)
    at async rm.getCandidates (C:\Users\masplund.REDMOND\AppData\Local\node\corepack\v1\yarn\4.11.0\yarn.js:141:1271)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Browser N/A
  • Version: node v20.14.0 yarn 4.12.0

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions