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

WorkloadIdentityCredential: TypeError: Cannot read property 'tenantId' of undefined #25827

Closed
1 task
brianpham93 opened this issue May 10, 2023 · 11 comments
Closed
1 task
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.

Comments

@brianpham93
Copy link

brianpham93 commented May 10, 2023

  • Package Name: @azure/identity
  • Package Version: 3.2.0
  • Operating system:
  • nodejs
    • version: 16

Describe the bug
If DefaultAzureCredential is used, this error will throw because there's no AZURE_TENANT_ID in environment variables

TypeError: Cannot read property 'tenantId' of undefined
    at new WorkloadIdentityCredential (<directory>\node_modules\@azure\identity\dist\index.js:1999:60)
    at new DefaultWorkloadIdentityCredential (<directory>\node_modules\@azure\identity\dist\index.js:3589:13)
    at <directory>\node_modules\@azure\identity\dist\index.js:3622:51
    at Array.map (<anonymous>)
    at new DefaultAzureCredential (<directory>\node_modules\@azure\identity\dist\index.js:3622:37)
    at Object.<anonymous> (<directory>\util\keyvault-service.js:1:2980)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module.replacementCompile (<directory>\node_modules\append-transform\index.js:58:13)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.<anonymous> (<directory>\node_modules\append-transform\index.js:62:4)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Module.patchedRequire [as require] (<directory>\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (<directory>\util\key-management.js:1:1998)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module.replacementCompile (<directory>\node_modules\append-transform\index.js:58:13)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.<anonymous> (<directory>\node_modules\append-transform\index.js:62:4)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Module.patchedRequire [as require] (<directory>\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (<directory>\util\secret-key-singleton.js:1:1964)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module.replacementCompile (<directory>\node_modules\append-transform\index.js:58:13)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.<anonymous> (<directory>\node_modules\append-transform\index.js:62:4)
    at Module.load (internal/modules/cjs/loader.js:950:32)

To Reproduce
Steps to reproduce the behavior:

  1. Use DefaultAzureCredential
const { DefaultAzureCredential } = require("@azure/identity");
const defaultAzureCredential = new DefaultAzureCredential();

Expected behavior
It should fallback to next available authentication option

@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 Workflow: 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 May 10, 2023
@orgads
Copy link
Contributor

orgads commented May 10, 2023

Proposed fix:

@Apokalypt
Copy link

Same bug for us, waiting for the PR to be resolved

@MartaSleboda
Copy link

Same here, looking forward to fixing

@kanaga-divya
Copy link

Same here. Is this a new issue? I am seeing this from today morning.

@Apokalypt
Copy link

Apokalypt commented May 10, 2023

Same here. Is this a new issue? I am seeing this from today morning.

Yes, this was added with the last release which added default credentials when using the DefaultAzureCredential constructor. All the credentials methods handle the fact that the "options" parameter is not mandatory and can therefore be "undefined" except for one which does not control this and causes the instantiation of DefaultAzureCredential to crash.
You have 2 easy solutions (until the real solution is deployed):

  • Rollback to @azure/identity v3.1.4
  • Pass en empty parameter when instantiating DefaultAzureCredential : new DefaultAzureCredential({ })

@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 needs-team-triage Workflow: This issue needs the team to triage. labels May 10, 2023
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label May 10, 2023
@KarishmaGhiya
Copy link
Member

The PR by @orgads has been merged. I am working on releasing the fix in version 3.2.1. Will update the thread when it's out.

@KarishmaGhiya
Copy link
Member

KarishmaGhiya commented May 11, 2023

Folks the version 3.2.1 for @azure/identity has released with the fix. Please feel free to use it. Also let me know if that works for you. Also thanks @orgads
cc: @Apokalypt @brianpham93 @MartaSleboda @kanaga-divya

@KarishmaGhiya KarishmaGhiya added needs-author-feedback Workflow: More information is needed from author to address the issue. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels May 11, 2023
@github-actions
Copy link

Hi @brianpham93. 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.

@Apokalypt
Copy link

Folks the version 3.2.1 for @azure/identity has released with the fix. Please feel free to use it. Also let me know if that works for you. Also thanks @orgads cc: @Apokalypt @brianpham93 @MartaSleboda @kanaga-divya

On our side, the fix have corrected the problem.
Thx

@brianpham93
Copy link
Author

Folks the version 3.2.1 for @azure/identity has released with the fix. Please feel free to use it. Also let me know if that works for you. Also thanks @orgads cc: @Apokalypt @brianpham93 @MartaSleboda @kanaga-divya

Thanks. The fix works for me

@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 May 12, 2023
@KarishmaGhiya
Copy link
Member

Thank you so much for the confirmation. I'll go ahead and mark this issue as resolved.

@KarishmaGhiya KarishmaGhiya removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label May 12, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 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

7 participants