Axios request closing with socket hang up

Viewed 20

Hi I am using a mac and I am trying to do a request with axios. Regardless if its an post request or a get request or even url ( I have tried multiple like google.com and etc.) I still keep getting socket hang up ECONNRESET Here's a simple request I do:

let config = {
      method: "get",
      url: "https://google.com"
    };

    try {
      const response = await axios(config);
      console.log(JSON.stringify(response));
    }
    catch(err){
      console.log(err.message, err.code)
    }
    res.send({JSON.stringify(response)});

The response always is socket hang up ECONNRESET. Any help will be greatly appreciated.

0 Answers
Related