Nodered crashing when using the node-red-contrib-cast node

I'm using this node to play audio on some of my cast enabled devices and although it functions, each time the node is called, node-red crashes with an error mentioning the node.error call telling me it's not a function ?

[error] TypeError: node.error is not a function
at errorHandler (/opt/node_modules/node-red-contrib-cast/cast-to-client.js:52:10)
at getSpeechUrl (/opt/node_modules/node-red-contrib-cast/cast-to-client.js:192:9)
at Timeout._onTimeout (/opt/node_modules/node-red-contrib-cast/cast-to-client.js:836:33)
at listOnTimeout (node:internal/timers:561:11)
at processTimers (node:internal/timers:502:7)
[11:33:11] WARNING: Node-RED crashed, halting add-on
[11:33:11] INFO: Node-RED stoped, restarting...
s6-rc: info: service legacy-services: stopping
[11:33:11] INFO: Node-RED stoped, restarting...
s6-svwait: fatal: supervisor died

running nodered as an HA add-on if it makes any difference
V3.0.2 (latest available version under HA)

by commenting out some of the affected lines it works without crashing but this shouldn't happen.

That is a known problem with that node (see "cast" node crashing Node Red · Issue #337 · Hypnos3/node-red-contrib-cast · GitHub)
it is reported that switching to node-red-contrib-castv2 (node) - Node-RED eliminates the issue.

I saw that post but the castV2 node is not nearly as user friendly as the cast node so I just wanted to let the NR team know that calling a valid function (node.error) seems to cause a full NR crash, so that perhaps some bug could be identified / fixed

It is a bug in the nodes code, not a issue with Node-RED. The author of the node is the one who needs to fix the problem, but the node hasn't been updated in two years.

You have a couple choices

  1. add an issue to the node and hope the author will fix it
  2. fork the node and fix it yourself
  3. find another node to use

I understand the issue originates from the node's code, but surely that shouldn't result in a fatal crash of NR ? that's the point I'm trying to make.

And the fix is for the author of the node to correct their bug. Their program is crashing causing NR to crash

If a node generates an uncaught exception then the only safe thing for node-red to do is to shutdown. It may indicate a catastrophic failure of some sort in the system and any other action by node-red might make things worse.

1 Like

OK, that makes sense.

I hope that by simply commenting out the lines the log mentioned I'm not going to mess up anything else.
As far as a fix, this is as far as my knowledge goes to be honest, but at least it seems to be working at the moment. :slightly_smiling_face: