# Node-RED crash after write boolean to CPU1500 OPC UA

**URL:** <https://discourse.nodered.org/t/node-red-crash-after-write-boolean-to-cpu1500-opc-ua/91107>\
**Category:** General\
**Tags:** opcua\
**Created:** [19 September 2024 12:01 UTC](https://discourse.nodered.org/t/node-red-crash-after-write-boolean-to-cpu1500-opc-ua/91107 "2024-09-19T12:01:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Michal](https://discourse.nodered.org/u/Michal)\
**Post date:** [19 September 2024 12:01 UTC](https://discourse.nodered.org/t/node-red-crash-after-write-boolean-to-cpu1500-opc-ua/91107/1 "2024-09-19T12:01:54Z")

</div>

Hi

I have Node-RED version 4.0.3 and CPU Siemens 1518F-4 PN/DP with OPC UA server.

After exporting data from PLC to CSV, I want to write one bool in the plc that the export was successful created and then I could delete the data in the plc. The problem occurs when I want to write boolean to true - crash my cmd with node-red.

I created a simple flow where I read the state of the variable from the OPC UA server via inject. That works. When I change the OPC UA configuration to WRITE, Node-RED crashes.

When I do it through another client, both reading and writing the variable work without problems.... Didn't you come across it? Alternatively, where could the problem be?

Thank you

Some additional info:

19 Sep 14:37:58 - [red] Uncaught Exception:  
19 Sep 14:37:58 - [error] TypeError: Cannot read properties of undefined (reading 'indexOf')  
at module.exports.build\_new\_dataValue (C:\Users\User.node-red\node\_modules\node-red-contrib-opcua\opcua\opcua-basics.js:998:22)  
at write\_action\_input (C:\Users\User.node-red\node\_modules\node-red-contrib-opcua\opcua\102-opcuaclient.js:1618:23) at OpcUaClientNode.processInputMsg [as \_inputCallback] (C:\Users\User.node-red\node\_modules\node-red-contrib-opcua\opcua\102-opcuaclient.js:749:11)  
at C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\nodes\Node.js:214:26  
at Object.trigger (C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\util\lib\hooks.js:166:13)  
at Node.\_emitInput (C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\nodes\Node.js:206:11)  
at Node.emit (C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\nodes\Node.js:190:25)  
at Node.receive (C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\nodes\Node.js:499:10)  
at deliverMessageToDestination (C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\flows\Flow.js:803:40)  
at Immediate. (C:\Users\User\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\flows\Flow.js:819:21)

 ![2024-09-19 15_04_16-Node-RED _ Flow 1 – Pracovný – Microsoft​ Edge](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/6/56e40ab4e1c317a1be9afb78f6b5f1e2d484e04e.jpeg)

 ![2024-09-19 15_06_23-OPC UA Client](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cbed848dc7e5daa45337d986490fcd1def9f7d52.jpeg)

---

<div class="post-metadata">

**Author:** ![iwanek7](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iwanek7/32/94688_2.png) [@iwanek7](https://discourse.nodered.org/u/iwanek7)\
**Post date:** [19 September 2024 14:58 UTC](https://discourse.nodered.org/t/node-red-crash-after-write-boolean-to-cpu1500-opc-ua/91107/2 "2024-09-19T14:58:12Z")

</div>

Did You read this?

> [@OPCUa write not writing](https://discourse.nodered.org/t/opcua-write-not-writing/32538):
>
> Hello, I am trying to write boolean value to my plc with OPCUa write node. but its not writing looks like there is issue with the OPCUa write node because even other bits are not writable. I have also readed many bits and variable with OPCUa read. These error are seen in debug window when I am trying to inject write "TypeError: Cannot read property 'match' of undefined "Error connecting to PLC: Error: getaddrinfo ENOTFOUND tcp://10.1.0.100" ( this error is always there even I am readi…

Did You use "OPCUA Item" node?

---

<div class="post-metadata">

**Author:** ![Michal](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Michal](https://discourse.nodered.org/u/Michal)\
**Post date:** [20 September 2024 06:19 UTC](https://discourse.nodered.org/t/node-red-crash-after-write-boolean-to-cpu1500-opc-ua/91107/3 "2024-09-20T06:19:04Z")

</div>

Thank you very much for the advice. I don't know why I couldn't find anywhere that I need to use the **OPC UA Item** node. I know - I was looking wrong. I tried to search here on the forum, but I had to overlook the topic you shared ☹ Many thanks again.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 December 2024 06:20 UTC](https://discourse.nodered.org/t/node-red-crash-after-write-boolean-to-cpu1500-opc-ua/91107/4 "2024-12-19T06:20:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
