gRPC "failed to pick subchannel" if server and client are hosted on different machines

Viewed 4234

The server and client connect successfully if using localhost. Here's how I connect to remote server in python:

with grpc.insecure_channel('x.x.x.x:50051', options=(('grpc.enable_http_proxy', 0),)) as channel:

The server code to set up the port is defined as:

server.add_insecure_port('[::]:50051')

I have tried to change that to "0.0.0.0:50051", but it didn't help. Does someone know the issue here?

1 Answers

I had the same problem, even when client and server on the same machine with firewall disabled. I solved my problem by ensuring the server was not using "localhost". It would not work when server was using localhost and client used the ip address of the PC. I had to set the host of both client and server to a physical ip address that can be accessed on your network.

Related