node-opcua: Meaning of "Invalid channel" error from client.createSession()?
const client = OPCUAClient.create({
endpointMustExist: false,
securityMode: MessageSecurityMode.SignAndEncrypt,
securityPolicy: SecurityPolicy.Basic256Sha256
});
await client.connect(endpointUrl);
const session = await client.createSession({
userName: data.userName,
password: data.password,
},
function(err) {
console.log(err)
}
);
When trying to connect to a server with user/pass and Basic256Sha256, I get this error “Invalid channel”. Other OPC-UA softwares connects to the server (not a node-opcua server) without any problems.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (3 by maintainers)
I found this other issue that explained what is happening. In my case this error appears over night when the machines running the opcua server will be shut off, therefore the connection is lost and there is no session to keepalive.
Solving is just as easy as connecting and creating a session when the keepalive fails.
And then:
The transaction timeout problem that you are having @cbudai is one I don’t have a clue about at the moment.
@simultsop I have not found any url for this.
But I fixed it by adding
keepSessionAlive: true
to theOPCUAClient.create
function.