Axios causes node.exe to crash without possibility to catch the exception
See original GitHub issueDescribe the bug
Axios v.0.21.0 causes node.exe to silently crash, without possibility to catch the exception. Occurs with node.js v.14.15.0 (current LTS Version, recommended for most users). Earlier or later versions works Ok (I have tested v.9.11.1 and v.15.1.0) Update: Node v.9.11.1 also crashing in the similar way (on Windows Server 2016 v.1607) Update 2: Basic Auth causes the crashing. Requests without authorization works ok so far Update 3: Node v.14.15.1 also crashing in the similar way
To Reproduce
Effect is not stable and not easy to be quickly reproduced, appears mostly on bad/slow internet connections. Most probably because of “connect ETIMEDOUT”, but this is only my guessing, because node.exe just unexpectedly terminates, without any additional info.
// This is example code for reproducing the problem. Actually nothing special, just continuously getting lots of data.
// Size of retrieved files is not important (from several kilobytes to several megabytes)
// MyApi is url/config of service-now.com REST API. Unfortunately I can’t share it.
var axios = require('axios');
let n=1;
test();
async function test() {
do {
await axios.get(MyApiUrl,MyApiConfig)
.then(res => console.log(n++, "got "+JSON.stringify(res.data).length+" bytes (node.js "+process.version+")"))
.catch(err => {console.error("ERROR: "+err.message);process.exit()})
} while (true)
};
Expected behavior
Even on more or less normal internet connection node.exe crashes within getting of one or two gigabytes of data (in summary, by portions, not at once). Choosing bad internet connection will bring the same result faster.
Environment
- Axios Version 0.21.0
- Node.js Versions 14.15.0, 14.15.1, v.9.11.1
- OS: Windows 10 v.1909 and 2004, and Windows Server 2016 v.1607
Additional context/Screenshots
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:20 (5 by maintainers)
Still encountering this with Axios 1.1.3 intermittently in Azure Functions.
I can reproduce the issue on macOS, ubuntu and node 14.18. The same code works on node v16+ throwing the stacktrace below
while in node 14 it fails in the async_hook callbackTrampoline while calling the callback.apply. the
cb
argument is undefined (asyncId = 0)not sure what happens inside nodejs but that is caused at this point on aborted connection errors as the node16 stacktrace can show. Hope that can help someone else as I spent hours before finding this thread and understanding why my promises were not resolved/rejected…