mikakaraila / node-red-contrib-opcua

A Node-RED node to communicate OPC UA. Uses node-opcua library.
Other
216 stars 197 forks source link

Error thrown while writing ExtensionObjectArray with range #738

Open kb4086 opened 1 month ago

kb4086 commented 1 month ago

Version 0.2.332

It is not possible to write an ExtensionObjectArray when a range is set:

{"log":"14:53:19.615Z :datatype_factory              :210   warning  ns=0;i=0 name= SimaticStructures  does not have binary encoding\n","stream":"stdout","time":"2024-10-01T14:53:19.616599674Z"}
{"log":"14:53:19.619Z :datatype_factory              :210   warning  ns=0;i=0 name= SimaticSystemStructures  does not have binary encoding\n","stream":"stdout","time":"2024-10-01T14:53:19.620217313Z"}
{"log":"14:53:20.063Z :populate_data_type_manager_104:62     Cannot find dataType Definition ! with nodeId =ns=2;i=6525 2:ParameterResultDataType false\n","stream":"stdout","time":"2024-10-01T14:53:20.064282667Z"}
{"log":"14:53:20.225Z :datatype_factory              :309   target namespace = ``\n","stream":"stdout","time":"2024-10-01T14:53:20.226199695Z"}
{"log":"14:53:20.231Z :datatype_factory              :310   registerFactory  : SimaticStructures already registered. dataTypeNodeId= ns=3;i=3400\n","stream":"stdout","time":"2024-10-01T14:53:20.232521133Z"}
{"log":"14:53:20.234Z :datatype_factory              :309   target namespace = ``\n","stream":"stdout","time":"2024-10-01T14:53:20.234782131Z"}
{"log":"14:53:20.236Z :datatype_factory              :310   registerFactory  : SimaticSystemStructures already registered. dataTypeNodeId= ns=3;i=3500\n","stream":"stdout","time":"2024-10-01T14:53:20.237321735Z"}
{"log":"14:53:20.505Z :populate_data_type_manager_104:62     Cannot find dataType Definition ! with nodeId =ns=2;i=15889 2:TransferResultDataDataType false\n","stream":"stdout","time":"2024-10-01T14:53:20.506557014Z"}
{"log":"14:53:20.507Z :populate_data_type_manager_104:62     Cannot find dataType Definition ! with nodeId =ns=2;i=15888 2:TransferResultErrorDataType false\n","stream":"stdout","time":"2024-10-01T14:53:20.508253879Z"}
{"log":"14:53:30.739Z :datatype_factory              :210   warning  ns=0;i=0 name= SimaticStructures  does not have binary encoding\n","stream":"stdout","time":"2024-10-01T14:53:30.741303831Z"}
{"log":"14:53:30.745Z :datatype_factory              :210   warning  ns=0;i=0 name= SimaticSystemStructures  does not have binary encoding\n","stream":"stdout","time":"2024-10-01T14:53:30.747081296Z"}
{"log":"14:53:31.201Z :populate_data_type_manager_104:62     Cannot find dataType Definition ! with nodeId =ns=2;i=6525 2:ParameterResultDataType false\n","stream":"stdout","time":"2024-10-01T14:53:31.202454677Z"}
{"log":"14:53:31.319Z :datatype_factory              :309   target namespace = ``\n","stream":"stdout","time":"2024-10-01T14:53:31.32065042Z"}
{"log":"14:53:31.321Z :datatype_factory              :310   registerFactory  : SimaticStructures already registered. dataTypeNodeId= ns=3;i=3400\n","stream":"stdout","time":"2024-10-01T14:53:31.322307937Z"}
{"log":"14:53:31.323Z :datatype_factory              :309   target namespace = ``\n","stream":"stdout","time":"2024-10-01T14:53:31.323751721Z"}
{"log":"14:53:31.325Z :datatype_factory              :310   registerFactory  : SimaticSystemStructures already registered. dataTypeNodeId= ns=3;i=3500\n","stream":"stdout","time":"2024-10-01T14:53:31.325602114Z"}
{"log":"14:53:31.481Z :populate_data_type_manager_104:62     Cannot find dataType Definition ! with nodeId =ns=2;i=15889 2:TransferResultDataDataType false\n","stream":"stdout","time":"2024-10-01T14:53:31.481919062Z"}
{"log":"14:53:31.482Z :populate_data_type_manager_104:62     Cannot find dataType Definition ! with nodeId =ns=2;i=15888 2:TransferResultErrorDataType false\n","stream":"stdout","time":"2024-10-01T14:53:31.483376226Z"}
{"log":"1 Oct 14:53:31 - [red] Uncaught Exception:\n","stream":"stdout","time":"2024-10-01T14:53:31.921440002Z"}
{"log":"1 Oct 14:53:31 - [error] TypeError: Cannot read properties of undefined (reading 'schema')\n","stream":"stdout","time":"2024-10-01T14:53:31.921757031Z"}
{"log":"    at EXTENSION.get schema [as schema] (/home/nodered/node-red-home/node-red-flows/node_modules/node-red-contrib-opcua/node_modules/node-opcua-schemas/source/dynamic_extension_object.ts:533:18)\n","stream":"stdout","time":"2024-10-01T14:53:31.921798263Z"}
{"log":"    at EXTENSION.toJSON (/home/nodered/node-red-home/node-red-flows/node_modules/node-red-contrib-opcua/node_modules/node-opcua-schemas/source/dynamic_extension_object.ts:849:37)\n","stream":"stdout","time":"2024-10-01T14:53:31.921820919Z"}
{"log":"    at JSON.stringify (\u003canonymous\u003e)\n","stream":"stdout","time":"2024-10-01T14:53:31.921842855Z"}
{"log":"    at write_action_input (/home/nodered/node-red-home/node-red-flows/node_modules/node-red-contrib-opcua/opcua/102-opcuaclient.js:1665:86)\n","stream":"stdout","time":"2024-10-01T14:53:31.921864251Z"}
{"log":"    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n","stream":"stdout","time":"2024-10-01T14:53:31.921885803Z"}

The used message properties were:

msg.payload = {value: newArray};
msg.topic = "ns=5;i=xxxx;datatype=ExtensionObjectArray;typeId=ns=5;i=yyyy";
msg.datatype = "ExtensionObjectArray";
msg.action = "write";
msg.range = "1";
mikakaraila commented 1 month ago

This is not supported at the moment, sorry. I will check later some error handling to the code...

Can be also missing from the node-opcua library.