NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
420 stars 52 forks source link

[Bug]: Not naming the host node causes a crash #424

Closed marcus-j-davies closed 3 years ago

marcus-j-davies commented 3 years ago

NRCHKB Plugin Version

1.3.6

Node JS Version

v14.16.0

NPM Version

6.14.11

Node-RED Version

2.0.0

Operating System

OSX (but others are likely affected)

What happened?

The following fatal crash when deploying, with Host nodes missing a name.

Error: Host Node not found
    at preInit.configure (/Users/marcusdavies/.node-red/node_modules/node-red-contrib-homekit-bridged/build/lib/HAPServiceNode.js:90:23)
    at preInit.init (/Users/marcusdavies/.node-red/node_modules/node-red-contrib-homekit-bridged/build/lib/HAPServiceNode.js:58:23)
    at /Users/marcusdavies/.node-red/node_modules/node-red-contrib-homekit-bridged/build/lib/HAPServiceNode.js:48:18

How to reproduce?

1 - Add a new service node 2 - Attach it to a newly created host node (but ensure it is not named) 3 - Deploy

Expected behavior:

for the name to be set to a default maybe, if not provided maybe

Additional comments?

I am not a user - I was just helping out on discord

Relevant log output

05 Aug 12:57:02 NRCHKB-Error:HAPServiceNode [dsfdfs:30beaa075577b49e] Host Node not found +0ms
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:
Error: Host Node not found
    at preInit.configure (/Users/marcusdavies/.node-red/node_modules/node-red-contrib-homekit-bridged/build/lib/HAPServiceNode.js:90:23)
    at preInit.init (/Users/marcusdavies/.node-red/node_modules/node-red-contrib-homekit-bridged/build/lib/HAPServiceNode.js:58:23)
    at /Users/marcusdavies/.node-red/node_modules/node-red-contrib-homekit-bridged/build/lib/HAPServiceNode.js:48:18
wolflu05 commented 3 years ago

i can confirm this, i had the same error earlier until i found this issue.

Shaquu commented 3 years ago

Based on comments from Discord:

@TheNON75 please confirm

TheNON75 commented 3 years ago

Confirmed