Open johntdyer opened 3 months ago
To narrow down the UnhandledPromiseRejection
can you add the following code to your settings.js
file to help capture a better description of the error? This can removed once the error happens.
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection: ', p, 'reason:', reason);
});
Secondly, you can connect directly to Node-RED and not through the Home Assistant proxy. https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/#configuration
Thank you for getting back to me... QQ though re: your request... how do I make this change to node-red given its running as a container as an add-on? Wont any change be lost as soon as I restart the process?
-John
On Jul 27, 2024, at 9:04 PM, Jason @.***> wrote:
To narrow down the UnhandledPromiseRejection can you add the following code to your settings.js file to help capture a better description of the error? This can removed once the error happens.
process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection: ', p, 'reason:', reason); }); Secondly, you can connect directly to Node-RED and not through the Home Assistant proxy. https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/#configuration
— Reply to this email directly, view it on GitHub https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/1451#issuecomment-2254300285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOG6QDOXKONK6TE35RVDLZOQ7QVAVCNFSM6AAAAABLSEZHAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGMYDAMRYGU. You are receiving this because you authored the thread.
Actually I think I found it in ~/addon_configs/a0d7b954_nodered
here is the file after editing, I assume this is at the right scope within this module ?
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection: ', p, 'reason:', reason);
});
module.exports = {
mqttReconnectTime: 15000,
serialReconnectTime: 15000,
functionGlobalContext: {
// os:require('os'),
// jfive:require("johnny-five"),
// j5board:require("johnny-five").Board({repl:false})
},
paletteCategories: [
"home_assistant",
"subflows",
"common",
"function",
"network",
"sequence",
"parser",
"storage",
],
logging: {
console: {
metrics: false,
audit: false,
},
},
editorTheme: {
projects: {
enabled: false,
},
},
};
here is the file after editing, I assume this is at the right scope within this module ?
correct
Have you narrowed it down? I am experiencing the same connection lost error everyday at the same time.
I managed to fix it, not sure if the core problem is the same for everyone. I used to access Home Assistant only through my public domain and public IP address. That IP address was internally routed back to my server without leaving the local network. Still, the IP changed every night.
It seems that node-red doesn't get notifiied or doesn't act upon losing connection with Home Assistant that way. Only once an automation later on actiively tries to reach Home Assistant (for me my wake-up automation), does node-red get an error communicating with Home Assistant. On the next request, node-red will connect to the correct IP again.
I solved it by setting up a local PKI with self-signed root certificate and connecting node-red to Home Assistant via a local domain and IP address instead. Hope this helps.
This issue is currently blocking further updates and releases of the add-on version of Node-RED.
This is in the logs (default settings, use add-on environment to connect to the server)
30 Sep 20:17:32 - [info] [server:Home Assistant] Connecting to http://supervisor/core
30 Sep 20:17:32 - [info] [server:Home Assistant] Connected to http://supervisor/core
30 Sep 20:17:32 - [red] Uncaught Exception:
30 Sep 20:17:32 - [error] UnhandledPromiseRejection: 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 "#<Object>".
Adding the debug code you gave above, it comes out with:
30 Sep 20:23:02 - [info] [server:Home Assistant] Connecting to http://supervisor/core
30 Sep 20:23:02 - [info] [server:Home Assistant] Connected to http://supervisor/core
Unhandled Rejection: Promise {
<rejected> { code: 'unknown_command', message: 'Unknown command.' }
} reason: { code: 'unknown_command', message: 'Unknown command.' }
Unhandled Rejection: Promise {
<rejected> { code: 'unknown_command', message: 'Unknown command.' }
} reason: { code: 'unknown_command', message: 'Unknown command.' }
Please note, I test against an older HA to ensure compatibility there as well: 2024.1.0.dev20231213
Will migrate that test instance to see if it makes a difference.
Describe the bug
About once a day the add-on crashes and the watchdog doesn't seem to trigger a restart, seems to have started w/ Home Assistant: 2024.07.00
To Reproduce
Start it, wait and watch for crash
Expected behavior
Crashes to not happen daily
Screenshots
No response
Example Flow
No response
Environment Information
Node-Red Addon - : 18.0.4 HassOS: 2024-07-03 Supervisor: 2024.07.00
Additional context
Supervisor logs
Forked from https://github.com/hassio-addons/addon-node-red/issues/1917