Node: net.Socket.prototype.connect is having TypeError when called without connectionListener

Created on 9 Mar 2017  路  10Comments  路  Source: nodejs/node

  • Version: 7.7.2
  • Platform: Linux ip-172-31-25-224 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem:

net.Socket.prototype.connect should work fine without callback (connectionListener) according to doc

but it's working like this

> (new net.Socket()).connect({ host:'google.com', port:80 })
TypeError: "listener" argument must be a function
    at Socket.once (events.js:307:11)
    at Socket.connect (net.js:943:10)
    at repl:1:20
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at REPLServer.defaultEval (repl.js:336:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.onLine (repl.js:533:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:191:7)

related PR: https://github.com/nodejs/node/pull/11667

confirmed-bug net

Most helpful comment

@nodejs/release When is a 7.7.3 planned? This bug is reported to be present only in 7.7.2 (I have not verified this, but its been noticed reasonably widely)

@fcanela the fix is almost approved for master, but I'm not sure when the next release is planned

All 10 comments

Amazing. I'm having this same issue after upgrading to the latest version of node and trying to run my application through pm2. I'll be watching closely. Thank you in advance!

@tc-mccarthy yes. i was experiencing same thing with pm2 and try to figure out what is the problem.

fyi, for now i came up with downgrading node to 7.7.1

@vhain not really a fix, but a workaround for me was downgrading to node v6.0.0. Things sprung back to life.

/cc @joyeecheung

Yeah..it's a bug due to the oversight of https://github.com/nodejs/node/pull/11667, which assumes the options are always normalized but they are not, should've fixed the test coverage before refactoring them, sorry for the inconvenience & thanks for the fix!

Yes I confirm that it's a bug.

We are affected by the same issue. Current version is broken. We switched back to 7.7.1 and everything works again.

I really appreciate the job you are doing and do not mean to introduce any hurry. There is any approximation on when we can expect a working current version? I would appreciate that information to decide if we should make fixes or wait.

@nodejs/release When is a 7.7.3 planned? This bug is reported to be present only in 7.7.2 (I have not verified this, but its been noticed reasonably widely)

@fcanela the fix is almost approved for master, but I'm not sure when the next release is planned

I'm having this same issue after upgrading to the latest version of node and trying to run my application through pm2. @vhain ,I use the node 7.7.1, It's work.thanks very much

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielstaleiny picture danielstaleiny  路  3Comments

cong88 picture cong88  路  3Comments

mcollina picture mcollina  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

srl295 picture srl295  路  3Comments