Skip to content

Random port generation occasionally produces bad port error #96

@jamesmbourne

Description

@jamesmbourne

What happened?

The unique port generator in

const rnd =
6000 +
((a + ((b - a + 1) * getRandomValues(new Uint32Array(1))[0]) / 2 ** 32) |
0);
will sometimes generate port numbers e.g. 6666 which are restricted https://superuser.com/a/188070

This causes clients to be unable to connect to the registry and will produce an error such as Caused by: Error: bad port when attempting to interact via fetch()

What would you expect to happen?

Only valid port numbers should be assigned to the registry

What steps did you take?

  1. Start the registry with a random port

Code PushUp package version

0.0.7

What operation system are you on?

Linux

Node version

No response

Relevant log output

47| 
       48|   // check if verdaccio is running
       49|   const res = await fetch(verdaccioUrl, {
         |               ^
       50|     signal: AbortSignal.timeout(1000),
       51|   });
   ❯ setupNxWorkspace src/index.ts:74:15
   ❯ tests/build.spec.ts:8:17
  
  Caused by: Error: bad port

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions