Skip to content

Commit 8919e6a

Browse files
authored
[Identity] node-fetch takes above 2 seconds to send the request on some environments (Azure#15937)
1 parent 018fd46 commit 8919e6a

File tree

1 file changed

+5
-1
lines changed
  • sdk/identity/identity/src/credentials/managedIdentityCredential

1 file changed

+5
-1
lines changed

sdk/identity/identity/src/credentials/managedIdentityCredential/imdsMsi.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ export const imdsMsi: MSI = {
9090
// not having a "Metadata" header should cause an error to be
9191
// returned quickly from the endpoint, proving its availability.
9292
const webResource = identityClient.createWebResource(request);
93-
webResource.timeout = updatedOptions?.requestOptions?.timeout || 500;
93+
94+
// In Kubernetes pods, node-fetch (used by core-http) takes longer than 2 seconds to begin sending the network request,
95+
// So smaller timeouts will cause this credential to be immediately aborted.
96+
// This won't be a problem once we move Identity to core-rest-pipeline.
97+
webResource.timeout = updatedOptions?.requestOptions?.timeout || 3000;
9498

9599
try {
96100
logger.info(`Pinging IMDS endpoint`);

0 commit comments

Comments
 (0)