I have a grpc server and a client (in my blog project). when I run the server, It seems everything is ok, when I run the client, I face this error, and both server and client close.
rpc error: code = Unavailable desc = transport is closing
I think error is related to this piece of code:
func newPost(c proto_blog.BlogServiceClient) {
fmt.Println("Starting to do a Unary RPC")
req := &proto_blog.ReqNewPost{
Title: "How can we make an gRPC server?",
Content: "First You have to.....\nAt the end, you have to....",
Author: "Arsham Ahora",
Date: fmt.Sprint(time.Now()),
}
res, err := c.NewPost(context.Background(), req)
if err != nil {
log.Fatalf("Error calling greet server: %v", err)
}
log.Printf("Response from Greet: %v", res.Id)
}
** I noticed this error is not related to whether you have Unary or Streaming.