IMD SolutionComputing LibraryShop main store

Troubleshooting

Troubleshoot Node-RED OPC UA When UaExpert Connects

Edge computing and IIoT Published 8 min read

Short answer

UaExpert connecting proves the server is up, not that Node-RED negotiates the same endpoint and certificate exchange. Set the security policy to None on an isolated network: if Node-RED then connects, the fault is certificate or encryption compatibility. The deciding evidence is the server-side log line for the same attempt, time-correlated against Node-RED's error.

On this page
  1. Why does UaExpert connect when Node-RED cannot?
  2. What should you check before changing any security setting?
  3. When is setting the security policy to None the right diagnostic?
  4. How do you read the two logs against each other?
  5. How do you get the certificates trusted in both directions?
  6. What does a Wireshark capture show that the logs do not?
  7. Which decision does each outcome force?
  8. Questions asked

UaExpert connecting while Node-RED fails almost always means the fault is in the security negotiation, not in the server you already enabled. The test that decides it: on an isolated network segment, set the OPC UA security policy to None and security mode to None on both sides, and retry against the exact same opc.tcp:// endpoint string UaExpert negotiated — port 4840 and path included. If Node-RED connects, you have a certificate or encryption compatibility problem, and the server log will show it as BadCertificateUntrusted; if it still fails, you have an endpoint or network-path problem. The evidence that names the cause either way is one pair of log lines — Node-RED's error and the server's record of the same connection attempt, time-correlated. Work the checks below in that order and you will land on one of four decisions.

Why does UaExpert connect when Node-RED cannot? #

Because UaExpert's working session only proves the server is enabled and reachable — it proves nothing about whether Node-RED negotiates the same endpoint, the same security policy, or the same certificate exchange, and that handshake is where these connections die.

UaExpert is a full reference client. On first contact it shows you the server's certificate and asks you to accept it, it walks the endpoint list the server publishes, and it negotiates the strongest policy both sides have in common. None of that behavior carries over to another client automatically.

Node-RED reaches OPC UA through community nodes — node-red-contrib-opcua is the usual one, built on the node-opcua library. The node generates its own client application certificate, presents a fixed set of security policies, and must be granted trust by the server before any session opens. When one client works and the other does not against the same enabled server, the difference lives in that handshake. Stop re-checking the server enablement and start comparing the two clients.

What should you check before changing any security setting? #

Five things, in this order: the exact endpoint string UaExpert negotiated, the node and library version you run, whether the server accepts anonymous access at all, write permission on Node-RED's certificate folder, and whether Node-RED sits on the same network path UaExpert used.

  1. The endpoint string. Copy the full opc.tcp:// string from UaExpert's working connection, port and path included. Port 4840 is the OPC UA default, but a server can publish several endpoints on different ports or with path suffixes, and Node-RED must point at one of the published strings exactly — not at a hand-typed address.
  2. The node and library version. Record the exact node package and version; the underlying node-opcua library decides which security policies and certificate behavior you get. Version pinning is also what keeps a rebuild of the edge box reproducible — the same discipline behind stable Node-RED gateway flows with vendor-pinned nodes.
  3. The user token. Confirm how UaExpert authenticated — anonymous or username. If the server requires credentials, an anonymous Node-RED client is rejected regardless of security policy.
  4. File permissions. The client node uses a certificate manager and creates its certificate folder on first run. If the Node-RED process cannot write that folder, you get connection errors that masquerade as server faults — check that the folder exists and is writable by the Node-RED user.
  5. Network position. If Node-RED runs in a container or on another VLAN, it is not testing the path UaExpert used. Test from the same host first, then move.

When is setting the security policy to None the right diagnostic? #

When one client connects and another does not, and you need certificates and encryption out of the path to see what remains — set it once, on an isolated segment, and time-box the test.

The OPC UA security model, Part 2 of the specification, is explicit about what None means: security mode None is valid only with security policy None, and that combination provides no security at all — no signing, no encryption, no certificate exchange. That is exactly why it works as a diagnostic. Set the server endpoint and the Node-RED client both to None and retry:

  • Node-RED connects — the fault was certificate or encryption compatibility. Skip to the trust section.
  • Node-RED still fails — the fault is endpoint, path, or authentication. Go to the logs.

The same failure class is not Node-RED-specific: the guidance for fixing OPC UA security policy None connection errors and the pattern documented for resolving policy-None connection errors in another client follow the same isolate-then-restore sequence.

One rule: policy None belongs on an isolated segment with no route to any production host — never on the plant network — and it comes off the moment the test ends.

How do you read the two logs against each other? #

Trigger exactly one connection attempt from Node-RED, find the server's log line for that same attempt, and read the server's rejection reason — that line, not the Node-RED error, names the fault.

A client-side error cannot tell you whether the request reached the server; the server log can, and it sorts the failure into three families: no record at all (the request never arrived), a rejection at the secure-channel or session stage (trust, policy, or token), or acceptance followed by silence (a browse or subscription problem further down the chain). Correlate before you interpret.

Worked example, illustrative timestamps for one attempt:

  • Node-RED debug output at client clock 09:14:22.506: session error on opc.tcp://192.168.10.40:4840.
  • Server log at server clock 09:14:21.931: session rejected, BadCertificateUntrusted.
  • Offset: 09:14:22.506 − 09:14:21.931 = 0.575 s, so 575 ms. These are the only two events within ±5 s on either side, so they are one attempt seen by both ends.
  • Decision: the request arrived and was refused for trust. Move the Node-RED application certificate into the server's trusted store and retry — do not touch the network.

The counter-case decides the other branch: the same client timestamp, and the server log has no line within ±5 s. Then the request never arrived, and no certificate work will fix it — you have a routing, firewall, or addressing problem.

How do you get the certificates trusted in both directions? #

The server must hold Node-RED's client certificate in its trusted store, and Node-RED must accept the server's certificate — each side decides trust on the certificate the other presents during the handshake, so one direction alone is never enough.

Node-RED's node generates a self-signed application certificate on first use. The server files an unrecognized client certificate as untrusted and rejects the session; moving it into the server's trusted list is what authorizes that specific client to open secure channels. On the Node-RED side, a node-opcua client keeps its own trust store for server certificates, and a self-signed server certificate has to land there too — check the node's certificate settings rather than assuming it accepts everything.

Expect the first attempt after any certificate change to fail and the second to succeed: the first exchange is what delivers the certificates each side has to judge. Then restore the real policy — and when Node-RED is the server end of a link, the same two-way trust discipline is part of hardening a Node-RED OPC UA server.

What does a Wireshark capture show that the logs do not? #

Whether Node-RED opens a TCP connection at all, whether OPC UA messages reach the device, and at which exchange the conversation stops — and under policy None the payloads are readable, which is the other reason the diagnostic runs unencrypted.

Capture on the Node-RED host or the server's switch port, filter on the server address and the OPC UA port, and read the trace in order:

  • No SYN from the Node-RED address: the node never tried — the endpoint in the node configuration is wrong.
  • SYN with no reply: the path drops the traffic — routing, firewall, or VLAN.
  • TCP handshake completes and the OPC UA Hello and OpenSecureChannel messages appear: the request arrives; the last message before the connection resets tells you which stage refused it.

The error string on the Node-RED side gives you the same split faster: a connection refused means a host answered that is not listening on that port — wrong port, or the server bound to another interface — while a timeout means no answer came back at all.

Which decision does each outcome force? #

Four outcomes, four fixes — the None test plus one correlated log pair always picks one row: fix the trust, fix the token, fix the endpoint, or fix the path.

  • None connects, server log showed a certificate or policy rejection: finish the two-way trust exchange, then restore SignAndEncrypt with a policy both stacks support — Basic256Sha256 is the common current choice — plus user credentials instead of anonymous.
  • None connects, server log showed a user-token rejection: the security layer was never the problem; configure the same user token UaExpert used and retry with the original policy.
  • None fails, server log empty for the attempt: the request never arrived; fix routing, firewalling, or the address, and confirm with a capture before touching certificates.
  • None fails, server sees the attempt and rejects the endpoint itself: wrong endpoint string; copy the published endpoint UaExpert negotiated into the node.

Once the session opens and the tags flow, the usual next step on an edge box is bridging that OPC UA data into MQTT — at that point the connection work is done and the pipeline work begins.

Questions asked

Why does the connection break again after Node-RED restarts in its container?

The client application certificate lives in a folder inside the container filesystem. If that folder is not on a mounted, persistent volume, a recreated container generates a new certificate and the server rejects it as unknown, undoing the trust you set up. Put the certificate folder on a persistent volume so every restart presents the same certificate.

How far apart can the two clocks be for log correlation to work?

Farther than you think, because you correlate by window, not by equality. Trigger one attempt, note the client timestamp, and search the server log a few seconds to either side; if exactly one server-side event falls in that window, you have your pair. Syncing both hosts to the same NTP source simply makes the pairing obvious at a glance.

The server log shows the attempt but rejects the user token. Is that still a certificate problem?

No. A user-token rejection under policy None means trust and policy were already fine and the fault is authentication: the server refused the anonymous session or the credentials supplied. Configure the token type and credentials UaExpert used, and retry with the original security settings.

Do I need Wireshark if the logs already name the rejection?

No. A matched rejection line ends the network investigation, because it proves the request arrived. Capture is for the cases the logs cannot decide: no server-side record while Node-RED still errors, or a failure stage the log does not name. In those cases the trace tells you whether TCP even opened.

Keep reading

  • How-to

    Harden a Node-RED OPC UA server exposing PLC tags

    A default Node-RED OPC UA server accepts any client that can reach its port until three changes land: set message security mode to SignAndEncrypt with the Basic256Sha256 policy, remove mode None and anonymous login, and admit clients only through application-certificate trust lists. Those three changes are the whole decision; the rest is execution.

    Edge computing and IIoT

  • Explainer

    Connect on-premise OPC UA and SQL servers to a cloud PI System

    Yes. Install the AVEVA adapters on-premise, on a small host next to the OPC UA and SQL servers, and point egress at PI Web API in the cloud; the PI Data Archive port is not a supported egress destination. Only the adapter-to-Web API direction needs an outbound route.

    Edge computing and IIoT

  • Troubleshooting

    Why OPC UA structs arrive at MQTT as type index 21

    The struct is not broken on the wire: it travels as an ExtensionObject, OPC UA built-in type 22, decodable only by a client that reads the server's type dictionary. A gateway that skips that lookup prints a placeholder, type index 21, instead of the members. Select the leaf member nodes and rebuild the struct in the consumer.

    Edge computing and IIoT