15

I'm trying to use hubot msg object to send http request, but finally get this error: Error: connect EINVAL 0.0.xx.xx:80 - Local (0.0.0.0:0)

A similar question is saying this is caused by hosts file, but no detail.

alisondong
  • 151
  • 1
  • 1
  • 6
  • 10
    Whatever api you are hitting, make sure it has protocol mentioned. For e.g. http://: – Shiva Jul 17 '18 at 20:40
  • 1
    Double check your : syntaxes. If it is a proxy_http problem, then, I think you can check this issue: [https://github.com/request/tunnel-agent/issues/39](https://github.com/request/tunnel-agent/issues/39) – Thanh Tran Jun 24 '19 at 03:48

1 Answers1

33

I've been seeing this problem multiple times during the last two years. In all cases it was what @Shiva said: either the protocol or the port was missing.

Here is the most recent occurrence of this problem a co-worker had with the axios module in a Node.js application:

axios({ method: "get", url: "hostname:8080/liveness" })

After prepending http it worked:

axios({ method: "get", url: "http://hostname:8080/liveness" })

Hedge
  • 16,142
  • 42
  • 141
  • 246