grpcui
grpcui copied to clipboard
The grpcui interface opens without anything

This is my proto file
syntax = "proto3";
package proto.TestService.v1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/api/annotations.proto";
option go_package = "api";
option (gogoproto.goproto_getters_all) = false;
service SearchService {
rpc Search(SearchRequest) returns (SearchResponse) {
option (google.api.http) = {
get:"/abc/say_hello"
};
}
}
message SearchRequest {
string request = 1 [(gogoproto.moretags)='form:"request" validate:"required"'];
}
message SearchResponse {
string response = 1 [(gogoproto.jsontag) = 'response'];
}
My run command
grpcui -import-path=E:/GOPATH/src/github.com/bilibili/kratos/third_party -proto=E:/GOPATH/src/github.com/bilibili/kratos/third_party/github.com/gogo/protobuf/gogoproto/gogo.proto -plaintext 127.0.0.1:9001
Service startup code
package main
import (
"context"
pb "kratos-demo/api"
"log"
"net"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc"
)
type SearchService struct{}
func (s *SearchService) Search(ctx context.Context, r *pb.SearchRequest) (*pb.SearchResponse, error) {
return &pb.SearchResponse{Response: "1111 Server"}, nil
}
const PORT = "9001"
func main() {
server := grpc.NewServer()
pb.RegisterSearchServiceServer(server, &SearchService{})
lis, err := net.Listen("tcp", ":"+PORT)
if err != nil {
log.Fatalf("net.Listen err: %v", err)
}
reflection.Register(server)
server.Serve(lis)
}
Looking forward to the answer to the question
@skyhuihui, thanks for reporting this. This would happen if the server's reflection service returns an empty list of service names. If the server is Go, I think this is probably expected if you are using gogo instead of the official proto runtime. You can read more about it here: https://github.com/grpc/grpc-go/issues/1873
I think grpcui should probably fail to start in this situation. It already does some pro-active initialization at startup, to download the RPC schema, so it could just fail to open if it receives an empty list of service names.