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

[core-http] node-fetch takes above 2 seconds to send the request on some environments #15935

Closed
sadasant opened this issue Jun 23, 2021 · 1 comment · Fixed by #15937
Closed
Assignees
Labels
Azure.Core bug This issue requires a change to an existing behavior in the product in order to be resolved.

Comments

@sadasant
Copy link
Contributor

sadasant commented Jun 23, 2021

While we stopped using node-fetch on core-rest-pipeline, core-http does use it. Node fetch takes above 2 seconds to begin sending network requests in some environments. We’re able to reproduce this issue in Kubernetes pods, but it could be present elsewhere.

It is possible to test this by running the following code on a Kubernetes pod (asume the latest versions of the dependencies):

const { ManagedIdentityCredential } = require("@azure/identity");
const nock = require("nock");

const credential = new ManagedIdentityCredential();

async function main() {
    nock.recorder.rec();
    token = await credential.getToken("https://vault.azure.net/.default", { requestOptions: { timeout: 2000 } });
    console.log(token);
}

main().catch((err) => {
    console.log("error code: ", err.code);
    console.log("error message: ", err.message);
    console.log("error stack: ", err.stack);
});

The code above won’t reach to the IMDS MSI endpoint before two seconds, causing the pipeline to abort the request.

nock here is used to log the responses. We have another issue which makes it hard to debug network requests: #15936

For the case of Identity, we should be able to solve this as soon as we move Identity to core-rest-pipeline: #15595 We’re planning to do this during July. However, that won’t solve the issue in core-http.

@sadasant sadasant added bug This issue requires a change to an existing behavior in the product in order to be resolved. Azure.Core labels Jun 23, 2021
@sadasant sadasant added this to the [2021] August milestone Jun 23, 2021
@sadasant sadasant self-assigned this Jun 23, 2021
@sadasant sadasant modified the milestones: [2021] August, Backlog Jun 23, 2021
@ramya-rao-a
Copy link
Contributor

#15937 fixes this issue in the context of requests made as part of the ManagedIdentityCredential where we previously had a very low default timeout of 500ms

In the next few months we will be moving all packages that use @azure/core-http to the newer @azure/core-rest-pipeline and lose the dependency on node-fetch, see #15594

Therefore, no plans to investigate the current issue here in core-http

cc @chradek @xirzec @jeremymeng

@xirzec xirzec removed this from the Backlog milestone May 17, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
None yet
3 participants