Reputation: 101
When starting my grpc server, I get an error saying 'No address added out of total 1 resolved' and 'server must be bound in order to start'. After comparing it with a working server, I realised that, while the working service uses 127.0.0.1 with the configured port as the ip address, the broken service tries to use 0.0.31.170 port 443. This incorrect address is passed from line 156 in the resolver-dns.js file (got this from running npm install @grpc/grpc-js). Does anyone know why this could happen? This is how my server is created in short:
server.bindAsync(process.env.GRPC_PORT, credentials, () => {
server.start();
console.log("gRPC server started at " + process.env.GRPC_PORT);
});
Upvotes: 1
Views: 3189
Reputation: 40136
I don't understand your question fully.
see: https://grpc.io/docs/languages/node/basics/#starting-the-server
You need to:
host:port
) in bindAsync
createInsecure
tooi.e.:
server.bindAsync(
`${process.env.GRPC_HOST}:${process.env.GRPC_PORT}`,
grpc.ServerCredentials.createInsecure(), () => {
server.start();
...
});
Upvotes: 4