Closed ralphwetzel closed 1 year ago
Thank you for the report & flow. I probably broke status on Function node when optimizing status recently. It should be a straightforward fix. I'll take a look.
I believe the object created on line 542 is properly initialized. However, the subtitles of private fields in JavaScript prevent them from being accessed when called through that instance. My mistake. It was broken by my status optimization because, prior to that, the code path didn't access a private field. Your proposed fix works because it bypasses that object and calls the true instance directly. Nice find.
Fix committed.
Confirmed. Thank you!
Calling
node.status()
in a FunctionNode throwsException: Node.prototype.status: get #outputs: undefined private property!
.This is a test case (JSON at the bottom of this post):
The FunctionNode's code does little more than calling
node.status()
:The reason seems to be that
status()
is called on thenode
object created in line 542 - which is not fully initialized. https://github.com/phoddie/node-red-mcu/blob/e00a3d7185bc61bf34d0b6259da9a0fbc668fd4c/nodered.js#L542-L552As a option to solve this issue, the
node
object should be empowered with additional properties that forward the job to the (fully initialized)this
of the FunctionNode.status()
is a first candidate, but most probably not the last.Line 551:
Test flow JSON: