node-mitm icon indicating copy to clipboard operation
node-mitm copied to clipboard

TypeError: server.listenerCount is not a function

Open njentit opened this issue 1 year ago • 3 comments

node:_http_server:1033 server.listenerCount('upgrade') > 0; ^ TypeError: server.listenerCount is not a function at parserOnIncoming (node:_http_server:1033:26) at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17) at socketOnData (node:_http_server:823:22) at TlsSocket.emit (node:events:519:28) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5) at InternalSocket.onStreamRead [as onread] (node:internal/stream_base_commons:191:23) at InternalSocket.readData (/home/njentit/Developments/NODEJS/SHPxBOT/node_modules/mitm/lib/internal_socket.js:168:8) at InternalSocket.emit (node:events:519:28)

njentit avatar Oct 05 '24 05:10 njentit

Hey,

Do you have some context for this error, too? Perhaps a small reproducible example and the Node.js version you used?

moll avatar Oct 05 '24 08:10 moll

Had similar issue with any new Websocket() connection used. spotted via jest-offline. as a solution -> mock websocket

zaqqaz avatar May 19 '25 16:05 zaqqaz

Hey! Perhaps you have a small reproducible example that just depends on Mitm.js? Is the Websocket you refer to the new native Node.js implementation?

moll avatar May 19 '25 16:05 moll