Skip to content

await axios.get() Never Resolves #4672

Closed
@ethan-cook

Description

@ethan-cook

Describe the issue

When calling axios.get() in an async function, passing in username and password authentication, intermittently the request will hang and never resolve.

Using the axios-debug-log package, I can see that Axios places the get request correctly, however, no response is ever returned. Nor is an error thrown.

This issue had also been found when using axios.get() to return an array buffer, however, I used a write stream as a temporary workaround for that case scenario.

Example Code

try {
	const { data } = await axios.get(`URL`, { auth: { username: username, password: password }});

	const images = _.filter(data.colorized, (image) => image["@primaryColorOptionCode"] == colorCode && image["@backgroundDescription"] == "Transparent" && image["@width"] == "2100");

	return images;
} catch(err) {
	this.logger.error(err.message);
	return [];
}

Expected behavior, if applicable

axios.get() to resolve its request, and return the response to the data constant.

I have tried both in Postman [9.17.1], Chrome [100.0.4896.127], and the vanilla Node.js HTTP package and was able to consistently make these GET requests. The problem only arises when utilizing Axios.

Environment

  • Axios Version [0.27.2]
  • Adapter [HTTP]
  • Browser [Chrome]
  • Browser Version [100.0.4896.127]
  • Node.js Version [17.8.0]
  • OS: Manjaro [21.2.6] and Ubuntu [lts-buster-slim]
  • Additional Library Versions Nest.js [8.0.0] axios-debug-log [0.8.4] lodash [4.17.21]

Additional context/Screenshots

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