RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received NaN.

See original GitHub issue

Running lhci server on k8s using patrickhulce/lhci-server image. When a pod restart occurs, a RangeError for the port is raised and the pod cannot be started successfully.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
patrickhulcecommented, Apr 14, 2020

@MahmoudDolah well something in the chain is setting the port to an invalid number. https://github.com/GoogleChrome/lighthouse-ci/pull/270 should add more debug information to help track it down.

0reactions
annezcommented, May 26, 2020

Okay I have found out the issue here @patrickhulce. The system documented in Kubernetes doesn’t take into account a deployment or a service being attached (this is how we would set up a Kube system). In the situation of an lhci server we would define:

  1. A deployment with LHCI container
  2. A service linking to the LHCI container
  3. An ingress connected to such service

In the kubernetes world, a service linked to a deployment automatically creates SERVICE_PORT and SERVICE_HOST ENV vars. This means if your service is named lhci then the env vars filtered down are LHCI_PORT=tcp://.... This is the issue people are encountering above.

Should we amend the documentation to highlight this clash?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Port should be >= 0 and < 65536. Received NaN - Stack ...
Anyone help me in resolving this error. ` WARNING: Adonis has detected an unhandled promise rejection, which may cause undesired behavior in ...
Read more >
Port should be >= 0 and < 65536. Received - Glitch Support
RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received . ... I get this error, and idk what to do.
Read more >
Port should be >= 0 and < 65536. Received NaN-mongodb
Coding example for the question RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received NaN-mongodb.
Read more >
Solved Can't start after update nodejs/npm - NodeBB
Received NaN. at validatePort (internal/validators.js:211:11) at ... RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536.
Read more >
T205505 process.env.PORT not defined
port ); ^ RangeError [ERR_SOCKET_BAD_PORT]: Port should be > 0 and < 65536. Received NaN. Clearly the javascript var port = parseInt(process.env.PORT, 10)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found