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

UnhandledPromiseRejectionWarning: .../nrchkb does not exist #510

Closed ralphwetzel closed 1 year ago

ralphwetzel commented 1 year ago

NRCHKB Plugin Version

1.5.0

Node JS Version

14.21.1

NPM Version

6.14.17

Node-RED Version

3.0.2

Operating System

RPi Bullseye

What happened?

I recently got the following UnhandledPromiseRejectionWarning:

(node:9843) UnhandledPromiseRejectionWarning: Error: [node-persist][readDirectory] /home/pi/mnt/node-red/nrchkb does not exists!
    at /home/pi/mnt/node-red/node_modules/node-persist/src/local-storage.js:294:13
    at suppressedCallback (fs.js:236:5)
    at FSReqCallback.oncomplete (fs.js:180:23)
(node:9843) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 30)

I guess, this might be due to the situation, that /home/pi/mnt/node-red/nrchkb is a mounted directory - which might become disconnected once in a while for whatever reason.

nrchkb currently recovers nicely - yet node.js complains that it's going to terminate in the future, if this happens again... 😉:

(node:9843) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How to reproduce?

Disconnect your .../nrchkb directory at runtime...

Expected behavior:

Handle the promise correctly; in this case: Don't complain, just retry next time...

Shaquu commented 1 year ago

Hey, not sure what I could do. We are writing to files from time to time so not good to unmount the directory :)

Shaquu commented 1 year ago

Will not be "fixed". nrchkb dir is required for runtime as we are saving data there.

Unfortuantely it is current design, might be changed in the future.

Please do open another issue in case of ... issues.