-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The connection may have been rejected by server, Err = (Invalid message header detected) #1262
Comments
@erossignon can you specify which additional info is required? |
Describe the bug* Step by step instruction to reproduce Steps to reproduce the behavior:
Expected behavior Screenshots Gist
gist:
Context
|
Just a quick update, I ran npm update for this library and the error log now shows a new line:
|
I am also facing this problem and have done few testing using different option. Client 1: Linux with node red version 3.0.2 and node-red-contrib-opcua version 0.2.306 OPC UA Server 1: Security: None I am able to establish connection with Security policy None, Basic256Sha256. The problem seem to be only with Basic128Rsa15 and Basic256. I could see the client produces the certificate to the server, which I can see and trust it. I don't see the server certificate accepted / rejected. client_secure_channel_layer :234 requestData not found for requestId = 1 try with 2 |
THis forum is for node-opcua not node-red-contrib-opcua; if you have any doubt, you need to provide a way to reproduce the issue with node-opcua only:
I give you a hint to start with: process.env.NODEOPCUADEBUG = ""; // "CLIENT{TRACE-SECURITY}";
// process.env.NODEOPCUADEBUG = "CLIENT{TRACE-SECURITY};TRANSPORT{CHUNK-HELACK}";
const { OPCUAClient, UserTokenType, MessageSecurityMode, SecurityPolicy } = require("node-opcua-client");
const chalk = require("chalk");
const endpointUrl = "opc.tcp://opcuademo.sterfive.com:26543";
async function test(security, endpoint) {
console.log({ security, endpoint });
const client = OPCUAClient.create({
...security,
endpointMustExist: false
})
;
try {
client.on("backoff", (nbRetry, delay) => console.log("backoff #", nbRetry, " retrying in ", delay / 1000.0, "seconds"));
await client.withSessionAsync(endpoint, async (session) => {
console.log(chalk.green("**************************************"));
console.log(chalk.green("Connection was successful !"));
console.log(chalk.green("**************************************"));
});
} catch (err) {
if (err.message.match(/socket has been disconnected by third party/)) {
console.log(chalk.magenta("**************************************"));
console.log(chalk.magenta(" The connection has been rejected by the server"));
console.log(chalk.magenta(" if you are using security please make sure that"));
console.log(chalk.magenta(" your client certificate is trusted by the server."));
console.log(chalk.magenta(" Refers to the server document to find out how to proceed. "));
console.log(chalk.magenta(""));
console.log(chalk.magenta(" By the way! Your client certificate PEM file is located here "));
console.log(chalk.magenta(" "), chalk.cyan(client.certificateFile));
console.log(chalk.magenta("**************************************"));
} else {
console.log(chalk.red("**************************************"));
console.log(chalk.red("Houston we have a problem:", err.message));
console.log(chalk.red("**************************************"));
}
}
console.log("\n");
console.log("-----------------------------------------------------");
}
async function main() {
const noSecurity = {};
const security1 = {
securityMode: MessageSecurityMode.SignAndEncrypt,
securityPolicy: SecurityPolicy.Basic256Sha256
};
const endpoint1 = {
endpointUrl,
userIdentity: { type: UserTokenType.Anonymous }
};
const endpoint2 = {
endpointUrl,
userIdentity: { type: UserTokenType.UserName, userName: "user1", password: "password1" }
};
await test(noSecurity, endpoint1);
await test(noSecurity, endpoint2);
await test(security1, endpoint1);
await test(security1, endpoint2);
}
main(); Please post node-red-contrib-opcua related issue to node-red-contrib-opcua |
Hi, I managed to identify the problem. The issue was caused due to the time synchronization. Client and server times drifted and after the restart causing issue. Synchronizing the time between the server and helped solved the problem. |
Hmm... I'm getting this when the clocks between server (Beckhoff PLC) and client (node-opcua) are out of sync (by a couple of minutes). The more out of sync they are, the earlier the problem arises. Right now there is a time difference of roughy 2 minutes between my computer and the PLC. This allows me to establish a session with the server and it works for a while, then suddenly terminate with the "requestData not found for requestId" message. |
Attached is some console output leading up to the crash. It seems to be related to renewing of security token, since it happens right after it is renewed. A stack trace (from another instance of the same error):
|
EirikVea this isssue is closed, please open a new one if necessary a,d don't forget to fill the template with required information. |
i'm getting this error while connecting to the device. what is the meaning of this error
The text was updated successfully, but these errors were encountered: