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

[Bug]: Port increment concatenates 1 instead of adding 1 #330

Open
JonLoesch opened this issue Apr 7, 2023 · 2 comments
Open

[Bug]: Port increment concatenates 1 instead of adding 1 #330

JonLoesch opened this issue Apr 7, 2023 · 2 comments
Assignees

Comments

@JonLoesch
Copy link

What happened?

I am pretty sure this is unintended behavior. I encountered the following very surprising log output:

kudu_ssh_user@45b8a1549992:/$ node /opt/webssh/index.js
WebSSH2 service reading config from: /opt/webssh/config.json
WebSSH2 service listening on 0.0.0.0:3000
WebSSH2 Address in use, retrying on port 30001

I assume the 3000 -> 30001 bump is because of javascript string / number typing nonsense. Not sure how big of an impact this is for anyone else. To behonest it's not an impact for me, I just though it was worth mentioning and bringing up

Node Version

14.19.2

NPM Version

6.14.17

Server OS Version

kudu_ssh_user@45b8a1549992:/$ uname -a Linux 45b8a1549992 5.10.164.1-1.cm1 #1 SMP Tue Jan 24 21:45:24 UTC 2023 x86_64 GNU/Linux kudu_ssh_user@45b8a1549992:/$ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

WebSSH2 release version

0.4.4

OS and Version of SSH server

No response

Browser Version

No response

Relevant log output

No response

@billchurch
Copy link
Owner

The issue most likely (was able to replicate) is that you're putting your port number in quotes which does, in fact, turn it into a string. Although this is wrong 😉 I should be checking for this behavior and not allowing it to happen in the first place.

Good Config

  "listen": {
    "ip": "0.0.0.0",
    "port": 3000
  },

results:

WebSSH2 service reading config from: /Users/bc/Documents/GitHub/webssh2/webssh2/app/config.json
WebSSH2 service listening on 0.0.0.0:3000
WebSSH2 Address in use, retrying on port 3001

Bad Config

  "listen": {
    "ip": "0.0.0.0",
    "port": "3000"
  },

results:

WebSSH2 service reading config from: /Users/bc/Documents/GitHub/webssh2/webssh2/app/config.json
WebSSH2 service listening on 0.0.0.0:3000
WebSSH2 Address in use, retrying on port 30001

@ginruh
Copy link

ginruh commented Sep 26, 2023

This issue also occurs when one passes port via env.

In my case I ran PORT=4000 npm start.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants