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

TypeError: self._handle.connect is not a function #12

Closed
mooyoul opened this issue Apr 7, 2016 · 9 comments
Closed

TypeError: self._handle.connect is not a function #12

mooyoul opened this issue Apr 7, 2016 · 9 comments

Comments

@mooyoul
Copy link

mooyoul commented Apr 7, 2016

2016-04-07 11 22 05

Something went wrong on net module binding when using why-is-node-running with request+bluebird combo.

I got this error:

net.js:822
      err = self._handle.connect(req, address, port);
                         ^

TypeError: self._handle.connect is not a function
    at connect (net.js:822:26)
    at net.js:984:7
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)

I tried to find the reason why it is fails, but i could't find.

This is test code which i used.

'use strict';

/**
 * Module dependencies.
 */
const why         = require('why-is-node-running');

const
  Promise     = require('bluebird'),
  request     = require('request');


const
  feeds = [
    'http://www.gojobs.go.kr/employ/rss.asp',
    'https://github.com/mooyoul.atom',
    'https://github.com/Flexget/Flexget/commits/develop.atom'
  ];

const fetch = (url) => {
  return new Promise((resolve, reject) => {
    request({
      method: 'GET',
      url: url
    }, (e, res, body) => {
      if (e) {
        return reject(e);
      }

      resolve(body);
    });
  });
};

Promise.map(feeds, (feed, index) => {
  console.log('fetching feed index %d: %s', index, feed);
  return fetch(feed);
});
@mooyoul
Copy link
Author

mooyoul commented Apr 7, 2016

Just to clarify, I tested more test cases.

It seems related to request module.
(not related to ES6 arrow function feature and bluebird package)

If i call request over once, it fails. calling request once is okay.

This is another test example:

'use strict';

/**
 * Module dependencies.
 */
const why         = require('why-is-node-running');

const
  request     = require('request');

request({
  method: 'GET',
  url: 'http://www.gojobs.go.kr/employ/rss.asp'
}, function (e, r, body) {
  request({
    method: 'GET',
    url: 'https://github.com/mooyoul.atom'
  }, function (e, r, body) {
  });
});

@yoshuawuyts
Copy link
Collaborator

Can confirm, have run into this before too (no repro available tho, was in a rush).

@nolanlawson
Copy link

Ran into this as well. Can confirm that the above test cases repros the failure, using Yosemite, request@2.72.0, and why-is-node-running@1.2.2.

@atrhacker
Copy link

Hey, I have the same issue.
So sad, because this tool seems perfect to diagnose my issue.
Is there any alternative ?

Thanks

@mafintosh
Copy link
Owner

I'll try to find some time over the weekend to fix this. Thanks for reporting it 👍

@forivall
Copy link

forivall commented Oct 4, 2016

I ran into this issue too, but https://github.com/myndzi/wtfnode was able to work.

@sibelius
Copy link

using why-is-node-running as cli does the same result

@mafintosh
Copy link
Owner

Should be fixed in latest

@mooyoul
Copy link
Author

mooyoul commented Mar 1, 2018

Ooh finally! Thanks :)

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

7 participants