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

Incorrect URL causes process shutdown #316

Closed
petarvucetin opened this issue Dec 30, 2020 · 2 comments
Closed

Incorrect URL causes process shutdown #316

petarvucetin opened this issue Dec 30, 2020 · 2 comments
Labels
Type: Bug Something isn't working

Comments

@petarvucetin
Copy link

Describe the bug

Node red crashes

To Reproduce

Steps to reproduce the behavior:
Type incorrect URL for the server with one space in it e.g. http:// homeassistant.local:8123 (notice space between last / and server name)

Which file is this information stored at?

Expected behavior

Not crashing

Screenshots

N/A

Example Flow

N/A

export goes here

Environment (please complete the following information):

  • Node Red Version: 1.0.4
  • Node.js Version: not sure - cannot get container to sart
  • NR Home Assistant Plugin Version: not sure
  • Is Node Red running in Docker: [e.g. yes/no/HA addon]

Other (please complete the following information):

  • Have you searched previous issues for duplicates?:

Additional context

29 Dec 17:57:53 - [info] Started flows
29 Dec 17:57:53 - [info] [server:Home Assistant] Connecting to http:// homeassistant.local:8123
29 Dec 17:57:53 - [red] Uncaught Exception:
29 Dec 17:57:53 - TypeError [ERR_INVALID_URL]: Invalid URL: ws:// homeassistant.local:8123/api/websocket
at onParseError (internal/url.js:241:17)
at new URL (internal/url.js:319:5)
at initAsClient (/data/node_modules/ws/lib/websocket.js:502:17)
at new WebSocket (/data/node_modules/ws/lib/websocket.js:71:7)
at connect (/data/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:428:28)
at Timeout.setTimeout [as _onTimeout] (/data/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:495:23)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@1.2.6 start: node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
npm ERR! Exit status 1

@zachowj zachowj added the Type: Bug Something isn't working label Dec 30, 2020
@zachowj
Copy link
Owner

zachowj commented Dec 30, 2020

It's stored in the flows_cred.json file which isn't really editable by hand.

If you don't have anything else stored in the cred file you could just remove it and NR should boot again.

If you don't know what it all saved in the cred file. You can search flows.json for "type":"server" record the value of id in the same level. It will be in the format of 2dad33ee.42bf5c. Then remove the whole server block.

example of the server block

{"id":"2dad33ee.42bf5c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},
  • Restart NR
  • create a new server config
  • shutdown NR
  • edit flows.json replace the server block id with the old one that you recorded
  • restart NR

@petarvucetin
Copy link
Author

thanks @zachowj . I was able to re-import the flow and change the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants