axios post requests - Error: getaddrinfo ENOTFOUND

Viewed 6975

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.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (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?

1 Answers

As @Javapocalypse commented, you should add http:// beginning of your url.

Related