Skip to content

Error: Failed to connect before the deadline. #2906

Open
@yashykt

Description

@yashykt

What version of gRPC and what language are you using?
gRPC version = 1.8.14, Language = javascript;

What operating system (Linux, Windows,...) and version?
Linux

What did you do?
Please provide either
I have been using gRPC for a long time. I was using it with an inscure connection. Then we decided to make the connection secure using mtls.
I tested it in my local system and I am able to connect it securely but when I moved it to the server it started facing error. I have no clue how to debug it further.
The error I keep getting is Error: Failed to connect before the deadline.

This is what I have added in the code for server

const credentials = grpc.ServerCredentials.createSsl(fs.readFileSync(String(process.env.GRPC_NOTIFICATION_CA_CERT)), [{
cert_chain: fs.readFileSync(String(process.env.GRPC_NOTIFICATION_SERVER_CERT)),
private_key: fs.readFileSync(String(process.env.GRPC_NOTIFICATION_SERVER_KEY))
}], true);

server.addService(package.service, {
youService
});

server.bindAsync("0.0.0.0:3006", credentials, (err) => {
if (err) {
console.error(err);
return;
}
console.log("GRPC server running at port 3006");
server.start();
});

client code

const credentialsClient1 = grpc.credentials.createSsl(
fs.readFileSync(String(process.env.GRPC_NOTIFICATION_CA_CERT)),
fs.readFileSync(String(process.env.GRPC_NOTIFICATION_CLIENT_KEY)),
fs.readFileSync(String(process.env.GRPC_NOTIFICATION_CLIENT_CERT))
);
const client2 = new package("notification-srv:3005", credentialsClient1);

client2?.waitForClientReady(Date.now() + 5000, (err) => {
if (err) {
console.error(err);
}
else {
console.info("GRPC client connected");
}
});
Another thing I am using Kubernetes for my application.

What did you expect to see?
It should have gotten connected since I am passing a valid certificate.

What did you see instead?
It is giving me error

Copied over from grpc/grpc#38820
@shubham-rapidops

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions