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] Bad network key will crash docker image with no UI message #61

Closed
2 tasks
Matt-PMCT opened this issue Dec 9, 2020 · 3 comments · Fixed by #75
Closed
2 tasks

[bug] Bad network key will crash docker image with no UI message #61

Matt-PMCT opened this issue Dec 9, 2020 · 3 comments · Fixed by #75
Assignees
Labels
bug Something isn't working

Comments

@Matt-PMCT
Copy link
Contributor

Version

Build/Run method

  • [ X ] Docker
  • PKG
  • Manually built (git clone - npm install - npm run build )

zwavejs2mqtt version: 1.0.0-alpha.0

Describe the bug
1.) The Network Key auto-generation (I'm assuming that is what the recycle symbol to the right is) did not do anything in Firefox
2.) If the user enters a Network key that is "3DMM7Z359G253QL0OHK1F2TUGT3IEKD5" there is an error generated that is only visible if you are attached to the docker image and watching the logs

z2m:App POST /api/settings 200 48.092 ms - 63 +8m
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
ZWaveError: The network key must be a buffer with length 16!
    at checkOptions (/usr/src/app/node_modules/zwave-js/src/lib/driver/Driver.ts:267:9)
    at new Driver (/usr/src/app/node_modules/zwave-js/src/lib/driver/Driver.ts:452:3)
    at ZwaveClient.connect (/usr/src/app/lib/ZwaveClient.js:1301:19)
    at Gateway.start (/usr/src/app/lib/Gateway.js:164:16)
    at startGateway (/usr/src/app/app.js:56:6)
    at /usr/src/app/app.js:285:5
  z2m:Mqtt MQTT client connected +79ms

To Reproduce
Steps to reproduce the behavior:

  1. Create brand new docker image
  2. Set up zwave with network key '3DMM7Z359G253QL0OHK1F2TUGT3IEKD5'
  3. Ensure you are attached to the docker image via SSH
  4. See error

Expected behavior
Errors should be made available to the user via the user interface to alert them there is a problem.

Additional context
I realize I had a bad network key :)

@Matt-PMCT Matt-PMCT added the bug Something isn't working label Dec 9, 2020
@AlCalzone
Copy link
Member

@robertsLando this call
https://github.com/zwave-js/zwavejs2mqtt/blob/03d4d0e6cb69a82156f588346ede71572ca85a2a/lib/ZwaveClient.js#L1301-L1304
should probably be guarded with a try-catch. It will throw if any of the options are outside the allowed range.

@robertsLando
Copy link
Member

robertsLando commented Dec 9, 2020

This needs a fix both on the backend and on the frontend as I shouldn't allow such chars in network key

@AlCalzone
Copy link
Member

Still there are a bunch of reasons why that call can throw

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

Successfully merging a pull request may close this issue.

3 participants