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

testPort gets called with 65536 #147

Open
fryorcraken opened this issue Mar 20, 2023 · 0 comments
Open

testPort gets called with 65536 #147

fryorcraken opened this issue Mar 20, 2023 · 0 comments

Comments

@fryorcraken
Copy link

Somehow, the library tests an invalid port:

Uncaught RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536. Received type number (65536).
      at new NodeError (node:internal/errors:399:5)
      at validatePort (node:internal/validators:390:11)
      at Server.listen (node:net:1868:5)
      at Object.internals.testPort (/home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:72:20)
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:154:22
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:3113:16
      at replenish (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1014:17)
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1019:9
      at eachLimit$1 (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:3199:24)
      at Object.<anonymous> (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1049:16)
      at Object.exports.getPort (/home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:151:17)
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:258:13
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1138:9
      at replenish (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1014:17)
      at iterateeCallback (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:998:17)
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:972:16
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1140:13
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:263:9
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:202:16
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:473:16
      at replenish (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:1009:25)
      at iterateeCallback (/home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:998:17)
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/node_modules/async/dist/async.js:972:16
      at /home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:163:16
      at Server.onListen (/home/runner/work/js-waku/js-waku/node_modules/portfinder/lib/portfinder.js:43:5)
      at Object.onceWrapper (node:events:627:28)
      at Server.emit (node:events:513:28)
      at Server.emit (node:domain:489:12)
      at emitListeningNT (node:net:1774:10)
      at processTicksAndRejections (node:internal/process/task_queues:81:21)

I called the library with a random port as some calls are done in parallel and I had conflict issues in the past:

    const startPort = Math.floor(Math.random() * (65535 - 1025) + 1025);

    const ports: number[] = await new Promise((resolve, reject) => {
      portfinder.getPorts(4, { port: startPort }, (err, ports) => {
        if (err) reject(err);
        resolve(ports);
      });
    });

I was expecting this error to be thrown instead:

return callback(new Error('No open ports available'));

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

1 participant