I've tried with many different servers and with different configurations but no matter what I try, I cannot get the connection to the OPCUA server to work. As a clean testing environment, I'm attempting to connect to Prosys OPC UA Simulation Server which should be pretty straightforward.
I can use UaExpert and TwinCat's sample OPCUA client to connect to the server and browse just fine, so the server is functioning correctly and im sure im using the correct url endpoint, but when I try with node-RED I always get the following even for the most simple flow:-
it says Invalid endpoint and to check the security policy eventhough the "None" policy should be working. The OPCUA Client settings:-
(Note: forum only let me post two screenshots, the security settings for the endpoint are all none)
The error messages in the console:-
Client connect error: The expression evaluated to a falsy value:
(0, assert_1.default)(s.length <= maxLength)
11 Aug 17:04:41 - [warn] [OpcUa-Client:c8ae0db29fa98602] OpcUaClientNode: Case A: Endpoint does not contain, 1==None 2==Sign 3==Sign&Encrypt, using securityMode: [1]
11 Aug 17:04:41 - [warn] [OpcUa-Client:c8ae0db29fa98602] OpcUaClientNode: using securityPolicy: ["http://opcfoundation.org/UA/SecurityPolicy#None"]
11 Aug 17:04:41 - [warn] [OpcUa-Client:c8ae0db29fa98602] OpcUaClientNode: Case B: UserName & password does not match to server (needed by Sign or SignAndEncrypt), check username: undefined and password: undefined
11 Aug 17:04:41 - [warn] [OpcUa-Client:c8ae0db29fa98602] OpcUaClientNode: Case C: With Sign you cannot use SecurityPolicy None!!
11 Aug 17:04:41 - [warn] [OpcUa-Client:c8ae0db29fa98602] OpcUaClientNode: Invalid endpoint parameters:
11 Aug 17:04:41 - [error] [OpcUa-Client:c8ae0db29fa98602] Client node error on: error: ["Wrong endpoint parameters: {\"id\":\"a189548fb2fb7199\",\"type\":\"OpcUa-Endpoint\",\"_closeCallbacks\":[],\"_inputCallback\":null,\"_inputCallbacks\":null,\"wires\":[],\"_wireCount\":0,\"credentials\":{},\"endpoint\":\"opc.tcp://PC15109.MACHINENAME:53530/OPCUA/SimulationServer\",\"securityPolicy\":\"None\",\"securityMode\":\"None\",\"login\":false,\"none\":true,\"usercert\":false,\"userCertificate\":\"\",\"userPrivatekey\":\"\",\"user\":null,\"password\":null}"]
11 Aug 17:04:41 - [error] [OpcUa-Client:c8ae0db29fa98602] Invalid endpoint
Just to further dive into the issue, I also tried to bypass node-RED and go straight to node by writing my own script to use node-opcua and connect to the server. Interestingly, I get the same assertion error and some more info, looks like it might have something to do with node.opcua-crypto:-
attempting to connect...
An error has occurred : AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
(0, assert_1.default)(s.length <= maxLength)
at parseBitString (C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-crypto\source\asn1.ts:91:15)
at _readBitString (C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-crypto\source\asn1.ts:113:16)
at _readSubjectPublicKeyInfo (C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-crypto\source\crypto_explore_certificate.ts:552:44)
at readTbsCertificate (C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-crypto\source\crypto_explore_certificate.ts:665:40)
at exploreCertificate (C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-crypto\source\crypto_explore_certificate.ts:714:29)
at publicKeyAndPrivateKeyMatches (C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-crypto\source\public_private_match.ts:30:33)
at C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-client\source\verify.ts:131:39
at Generator.next (<anonymous>)
at C:\Users\binahmad\Documents\SWE\code\1 - Projects\20230717_opcua_Interface_testing_tool\sample-node-opcua-client\node_modules\node-opcua-client\dist\verify.js:8:71
at new Promise (<anonymous>) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}
I've tried many things over the past few days and am at my wits end, any help will be incredibly appreciated