Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

127.0.0.1:0 causes exception in io.js@2 #67

Closed
stevenvachon opened this issue May 21, 2015 · 7 comments
Closed

127.0.0.1:0 causes exception in io.js@2 #67

stevenvachon opened this issue May 21, 2015 · 7 comments

Comments

@stevenvachon
Copy link
Contributor

request lib also has this issue: request/request#1596

@floatdrop
Copy link
Contributor

@stevenvachon hm... I get this error only on iojs@2, but not in IOjs@1.8.2, Node 0.10 or 0.12. Also only 127.0.0.1:0 host is throwing error, which is pretty strange.

@floatdrop floatdrop changed the title Uncaught Error: connect EADDRNOTAVAIL 127.0.0.1:0 causes exception in io.js@2 May 22, 2015
@sindresorhus
Copy link
Owner

Is there an io.js ticket for this? If not, can you open one? I don't see how this is relevant to got though. We're just a consumer of the HTTP API.

@stevenvachon
Copy link
Contributor Author

var req = require("http").request({hostname:"127.0.0.1",port:0});
req.on("error",function(e){throw e});

does not produce the same error

@julien-f
Copy link
Contributor

Again, for me it makes no sense to attempt to connect to port 0…

@stevenvachon
Copy link
Contributor Author

It doesn't, and is the cause of dev error. But should it throw an error when all other errors are passed in the callback (in "request" and "got" libs)

@julien-f
Copy link
Contributor

Ahhh, I understand now!

Indeed it would make sense for all errors to be async.

@sindresorhus
Copy link
Owner

Seems like it's fixed in Node 4:

❯ node -e 'require("./")("http://127.0.0.1:0", err => console.error(err));'     
{ [RequestError: connect EADDRNOTAVAIL 127.0.0.1 - Local (0.0.0.0:65229)]
  message: 'connect EADDRNOTAVAIL 127.0.0.1 - Local (0.0.0.0:65229)',
  code: 'EADDRNOTAVAIL',
  host: '127.0.0.1:0',
  hostname: '127.0.0.1',
  method: 'GET',
  path: '/' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants