moll / node-mitm

Intercept and mock outgoing Node.js network TCP connections and HTTP requests for testing. Intercepts and gives you a Net.Socket, Http.IncomingMessage and Http.ServerResponse to test and respond with. Super useful when testing code that hits remote servers.
Other
637 stars 48 forks source link

Breaks with node.js 11.8.0: [ERR_INVALID_ARG_TYPE]: The "err" argument must be of type number. Received type undefined #56

Closed papandreou closed 5 years ago

papandreou commented 5 years ago

Updating node from 11.7.0 to 11.8.0 makes my tests and the node-mitm test suite fail with:

     Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "err" argument must be of type number. Received type undefined
      at validateNumber (internal/validators.js:130:11)
      at Object.getSystemErrorName (util.js:394:3)
      at errnoException (internal/errors.js:363:21)
      at Socket._final (net.js:368:25)
      at callFinal (_stream_writable.js:617:10)
      at processTicksAndRejections (internal/process/next_tick.js:76:17)

The answer must be buried somewhere in https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V11.md#11.8.0

moll commented 5 years ago

Ugh. I'm worried eventually the popularity of ES6 within Node will forbid Mitm's hooking entirely. Hopefully not yet at least. Thanks for bringing v11.8 probs up though! Makes me happy I personally stick to ancient LTS versions of software — I'm seldom affected by such constant changes. :P

moll commented 5 years ago

Fixed it. I'll push in a sec, see if it works fine on all Node versions and then publish a release.

moll commented 5 years ago

Mitm.js v1.6 is live! Please give it a spin and report back if it's not working. Thanks again for the heads-up!

papandreou commented 5 years ago

Thanks a lot! That was some fast action 💪🏻