I'm using axios inside a cli node script. I've noticed that sometimes inside the console this error will be logged:
Error: getaddrinfo ENOTFOUND www.foobar
at GetAddrInfoReqWrap.onlookup [as onplete] (node:dns:67:26) {
errno: -3008,
code: 'ENOTFOUND',
It will be handled by the .catch()
function and the next axios request to the same address will continue work and I get 200 status code. Is there any reason that cause that a axios.post
request can generate that error?
I'm using axios inside a cli node script. I've noticed that sometimes inside the console this error will be logged:
Error: getaddrinfo ENOTFOUND www.foobar.
at GetAddrInfoReqWrap.onlookup [as onplete] (node:dns:67:26) {
errno: -3008,
code: 'ENOTFOUND',
It will be handled by the .catch()
function and the next axios request to the same address will continue work and I get 200 status code. Is there any reason that cause that a axios.post
request can generate that error?
- 2 Try adding http:// before your url – Javapocalypse Commented Apr 9, 2021 at 22:58
- I am facing the same error, Can you please post your code so that it helps others? – s d Commented Dec 16, 2022 at 13:19
1 Answer
Reset to default 2As @Javapocalypse mented, you should add http://
beginning of your url.