I have a gRPC client and a server, when I run them they seem to be running fine, but when I try to dial a server with a client I get an error:
"Error": {
"code": 14,
"message": "all SubConns are in TransientFailure"
},
No idea what is it. I tried to find a solution with google, no success there.
Any ideas? Here is my server code:
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", cfg.Host, cfg.Port))
if err != nil {
logger.Critical(ctx, "failed to listen: %v", err)
} else {
logger.Info(ctx, "[userserver] running at %s:%d", cfg.Host, cfg.Port)
}
grpcServer := grpc.NewServer()
userServer := userserver.New()
pb.RegisterDomainServer(grpcServer, userServer)
rpcErr := grpcServer.Serve(lis)
if rpcErr != nil {
logger.Critical(ctx, "failed to serve: %v", rpcErr)
}
btw the server here shows log:
2018/02/08 07:03:37.603287 INFO: [userserver] running at localhost:3001
and client:
conn, err := grpc.Dial(c.serverAddr, grpc.WithInsecure())
if err != nil {
return err
}
defer conn.Close()
client := pb.NewDomainClient(conn)
_, err = client.Dispatch(ctx, &pb.Command{
Name: command,
Payload: payload,
})
and this is port buff
service Domain {
rpc Dispatch(Command) returns (Response);
}
message Command {
string name = 1;
bytes payload = 2;
}
message Response {}