# Issues reading data from OPC-UA server

**URL:** <https://discourse.nodered.org/t/issues-reading-data-from-opc-ua-server/53449>\
**Category:** General\
**Created:** [9 November 2021 12:08 UTC](https://discourse.nodered.org/t/issues-reading-data-from-opc-ua-server/53449 "2021-11-09T12:08:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OriolFM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/oriolfm/32/30710_2.png) [@OriolFM](https://discourse.nodered.org/u/OriolFM)\
**Post date:** [9 November 2021 12:08 UTC](https://discourse.nodered.org/t/issues-reading-data-from-opc-ua-server/53449/1 "2021-11-09T12:08:40Z")

</div>

I keep working on an industrial application to integrate all the data of the machines in our plant for their posterior storage in a DB and process.

Until now, I'm using S7 nodes to retrieve the PLC data from a specific vendor, some http nodes with GET/POST commands to retrieve the data of the mobile robots fleet manager, and now I have to get data from another vendor who decided to use OPC-UA to offer the data.

I started with UaExpert to connect to the server. My idea was to get the node IDs and subscribe to the values I need, so I receive regular updates when the values change. I would then update the values in a global context to store the data, and regularly save those values to the DB.

The settings of the server are as such:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/7/17a86a9b679983d7c4d77533b1242a6f85b7f9b7.png)

This is the test flow I have on node-red:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/2/52e4ea1d65d3721d58f21878f16a07bd395c3f9b.png)

The inject node is using the timestamp as payload and the tag ID from UaExpert as topic:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b2d64df5e19a8c9a284542d934ff023718d872ee.png)

The OPC UA Client node is configured like this:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/6/861a23cd80d63a8d42cb925973bd3aa756cdf2a4.png)  
I selected READ and not subscribe until I'm sure that I'm getting the data I want. Since the login in UaExpert is using self-certificate, I selected the same on the OPC UA client node.

However, when I deploy and node-red tries to connect, I get the following 3 output messages in the debug window:

```auto
OpcUaClientNode: Create Client: [{"securityPolicy":"1","securityMode":3,"clientCertificateManager":"2","requestedSessionTimeout":300000,"clientName":"3","endpointMustExist":false,"defaultSecureTokenLifetime":200000,"connectionStrategy":"4","keepSessionAlive":true},"http://opcfoundation.org/UA/SecurityPolicy#Basic256",{"untrustUnknownCertificate":true,"state":4,"folderPoolingInterval":5000,"_watchers":"5","_readCertificatesCalled":true,"_filenameToHash":"6","_thumbs":"7","_pending_crl_to_process":0,"queue":"8","location":"9","keySize":2048,"referenceCounter":0,"automaticallyAcceptUnknownCertificate":true},"",{"maxRetry":10512000,"initialDelay":5000,"maxDelay":30000},[],{"C:\\Users\\ferrerons\\AppData\\Roaming\\node-red-opcua-nodejs\\Config\\PKI\\trusted\\certs\\NodeOPCUA-Client@proddata[fa43bffd02fadd1eb2d18b73d95f5f39e3e76c4e].pem":"10"},{"rejected":"11","trusted":"12","issuers":"13","crl":"14","issuersCrl":"15"},[],"C:/Users/ferrerons/AppData/Roaming/node-red-opcua-nodejs/Config/PKI",...

```

```auto
OpcUaClientNode: Case A: Endpoint does not contain, 1==None 2==Sign 3==Sign&Encrypt securityMode:[3] securityPolicy:["http://opcfoundation.org/UA/SecurityPolicy#Basic256"]

```

```auto
OpcUaClientNode: Case B: UserName & password does not match to server (needed by Sign): undefined undefined

```

Then I added a catch node connected to a debug node with the complete msg, but it does not catch anything, and still get the same error output (and no information about the tag I was trying to read).

Any ideas on what I'm doing wrong?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![OriolFM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/oriolfm/32/30710_2.png) [@OriolFM](https://discourse.nodered.org/u/OriolFM)\
**Post date:** [15 November 2021 09:51 UTC](https://discourse.nodered.org/t/issues-reading-data-from-opc-ua-server/53449/2 "2021-11-15T09:51:18Z")

</div>

OK, this might be another case of self-solved problem.

It looked like I was doing everything correctly, but the system administrator had set the firewall to block all the ports except for a few. Turns out all the ports for OPC-UA between the node-red server and the OPC-UA server in the machine were blocked.

After the sysadmin unlocked them, I got good results:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/2/e207d1fd5142fce9519991b5efe52dda538b2486.png)

If you're having similar problems, check that the ports are open before doing anything else, or you will waste hours of your time by looking for causes that are not there.

---

<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:** [29 November 2021 09:51 UTC](https://discourse.nodered.org/t/issues-reading-data-from-opc-ua-server/53449/3 "2021-11-29T09:51:37Z")

</div>

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