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
416 stars 52 forks source link

[Bug]: Node-RED 1.1.2 crash after upgrade to Homekit-bridged 1.1.2 #304

Closed Christian-Me closed 4 years ago

Christian-Me commented 4 years ago

Describe the bug After updating to latest Version 1.1.2 Node-RED 1.1.2 crash during flow start

When I disable my homekit flow and the config node Node-RED starts normal (withot homekit functionalities)

To Reproduce Steps to reproduce the behavior:

  1. Update to 1.1.2
  2. Start Node-RED

Expected behavior No crash.

Screenshots

17 Jul 21:37:07 - Error: Invalid IV length
    at Cipheriv.createCipherBase (internal/crypto/cipher.js:79:18)
    at Cipheriv.createCipherWithIV (internal/crypto/cipher.js:115:20)
    at new Cipheriv (internal/crypto/cipher.js:217:22)
    at Object.createCipheriv (crypto.js:109:10)
    at Object.chacha20_poly1305_encryptAndSeal (C:\Users\cmeinert\.node-red\node_modules\hap-nodejs\src\lib\util\hapCrypto.ts:90:25)
    at HAPServer._this._handlePairVerifyStepOne (C:\Users\cmeinert\.node-red\node_modules\hap-nodejs\src\lib\HAPServer.ts:553:33)
    at HAPServer._this._handlePairVerify (C:\Users\cmeinert\.node-red\node_modules\hap-nodejs\src\lib\HAPServer.ts:515:12)
    at IncomingMessage.<anonymous> (C:\Users\cmeinert\.node-red\node_modules\hap-nodejs\src\lib\HAPServer.ts:280:24)
    at IncomingMessage.emit (events.js:189:13)
    at endReadableNT (_stream_readable.js:1103:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Desktop (please complete the following information):

Node-RED Version: v1.1.2 Node.js Version: v10.15.1 Windows_NT 10.0.18363 x64 LE NPM version: v6.4.1 NRCHKB Plugin Version: 1.1.2

Additional context Worked before without major problems.

Shaquu commented 4 years ago

Please update nodejs to latest

Christian-Me commented 4 years ago

Upgrading to Node.js 12.18.2 LTS (recomended by Node-RED) helped.

Thank you.

thetest3r commented 1 year ago

I think I'm getting the same issue?

9 May 18:59:36 - [info] Node-RED version: v3.0.2
9 May 18:59:36 - [info] Node.js  version: v18.14.2
9 May 18:59:36 - [info] Linux 6.1.21-v8 arm64 LE
9 May 18:59:38 - [info] Loading palette nodes
9 May 18:59:50 - [info] Dashboard version 3.4.0 started at /endpoint/ui
9 May 18:59:53 - [info] Settings file  : /etc/node-red/config.js
9 May 18:59:53 - [info] Context store  : 'default' [module=memory]
9 May 18:59:53 - [info] User directory : /config/node-red/
9 May 18:59:53 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 May 18:59:53 - [info] Flows file     : /config/node-red/flows.json
9 May 18:59:53 - [info] Server now running at http://127.0.0.1:46836/
9 May 18:59:53 - [info] Starting flows
9 May 18:59:53 - [info] Started flows
[18:59:53] INFO: Starting NGinx...
9 May 18:59:58 - [info] [server:Home Assistant] Connecting to http://supervisor/core
9 May 18:59:58 - [info] [server:Home Assistant] Connected to http://supervisor/core
9 May 19:00:00 - [red] Uncaught Exception:
9 May 19:00:00 - [error] TypeError: Invalid initialization vector
    at Cipheriv.createCipherBase (node:internal/crypto/cipher:122:19)
    at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:141:3)
    at new Cipheriv (node:internal/crypto/cipher:249:3)
    at Object.createCipheriv (node:crypto:141:10)
    at Object.chacha20_poly1305_encryptAndSeal (/config/node-red/node_modules/hap-nodejs/src/lib/util/hapCrypto.ts:90:25)
    at HAPServer._this._handlePairVerifyStepOne (/config/node-red/node_modules/hap-nodejs/src/lib/HAPServer.ts:553:33)
    at HAPServer._this._handlePairVerify (/config/node-red/node_modules/hap-nodejs/src/lib/HAPServer.ts:515:12)
    at IncomingMessage.<anonymous> (/config/node-red/node_modules/hap-nodejs/src/lib/HAPServer.ts:280:24)
    at IncomingMessage.emit (node:events:513:28)
    at endReadableNT (node:internal/streams/readable:1359:12)

And according to the node-red website (https://nodered.org/docs/faq/node-versions): Node.js version: v18.14.2 is supported. I am on a Raspverry Pi running Node-Red on HomeAssistant add-on