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

CredentialUnavailableError: ManagedIdentityCredential: Authentication failed. Message uuidFunction is not a function #25541

Closed
1 task
brianpham93 opened this issue Apr 12, 2023 · 2 comments
Assignees
Labels
Azure.Core 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. needs-team-attention This issue needs attention from Azure service team or SDK team

Comments

@brianpham93
Copy link

brianpham93 commented Apr 12, 2023

  • Package Name: @azure/identity
  • Package Version: 3.1.3
  • Operating system: Linux
  • nodejs
    • version: 12

Describe the bug
Getting error

here's the dependencies from pnpm-lock.yaml

/@azure/identity@3.1.3:
    resolution: {integrity: sha512-y0jFjSfHsVPwXSwi3KaSPtOZtJZqhiqAhWUXfFYBUd/+twUBovZRXspBwLrF5rJe0r5NyvmScpQjL+TYDTQVvw==}
    engines: {node: '>=14.0.0'}
    dependencies:
      '@azure/abort-controller': 1.1.0
      '@azure/core-auth': 1.4.0
      '@azure/core-client': 1.7.2
      '@azure/core-rest-pipeline': 1.10.3
      '@azure/core-tracing': 1.0.1
      '@azure/core-util': 1.3.0
      '@azure/logger': 1.0.4
      '@azure/msal-browser': 2.35.0
      '@azure/msal-common': 9.1.1
      '@azure/msal-node': 1.17.0
      events: 3.3.0
      jws: 4.0.0
      open: 8.4.2
      stoppable: 1.1.0
      tslib: 2.5.0
      uuid: 8.3.2
    transitivePeerDependencies:
      - supports-color
    dev: false

To Reproduce
Steps to reproduce the behavior:

  1. Install @azure/identity@3.1.3 in nodejs project running on linux
  2. initiate new managed identity const credential = new ManagedIdentityCredential();
  3. Get error
CredentialUnavailableError: ManagedIdentityCredential: Authentication failed. Message uuidFunction is not a function
    at ManagedIdentityCredential.getToken (D:\home\site\wwwroot\node_modules\@azure\identity\dist\index.js:2294:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Expected behavior
Managed identity credential should be initialized successfully

@github-actions github-actions bot added Azure.Identity 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-triage This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 12, 2023
@xirzec xirzec added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 12, 2023
@xirzec
Copy link
Member

xirzec commented Apr 12, 2023

Looks related to the recent change to remove the uuid dependency:

I think the issue is that you are using Node 12, an unsupported version that has passed out of LTS. The function we're relying on was added in Node 14: https://nodejs.org/dist/latest-v18.x/docs/api/crypto.html#cryptorandomuuidoptions

If you are not able to upgrade to a supported version of Node, I believe you could work around this by depending on the uuid module yourself and assigning it to globalThis.crypto.randomUUID:

import { v4 as uuidv4 } from 'uuid';
globalThis.crypto.randomUUID = uuidv4;

@mpodwysocki does this sound right to you? Maybe we should throw an error here if we can't resolve the expected function that mentions the minimum node version?

@xirzec xirzec added Azure.Core and removed needs-team-triage This issue needs the team to triage. labels Apr 12, 2023
@github-actions github-actions bot added the needs-team-attention This issue needs attention from Azure service team or SDK team label Apr 12, 2023
mpodwysocki added a commit that referenced this issue Apr 13, 2023
### Packages impacted by this PR

- @azure/core-util

### Issues associated with this PR

- #25501
- #25541 
- #25538 
- #25532

### Describe the problem that is addressed by this PR

Adds the native implementation if missing in older Node.js

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [x] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [x] Added a changelog (if necessary)
@mpodwysocki
Copy link
Contributor

Fixed as of #25555

@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core 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. needs-team-attention This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

3 participants