1

Hello I have service/route in my local kong .

I have grpc server with reflection in python. It works fine on 50051 port where grpc server is on. but when ran from kong without proto file doesnt get valid response

With -proto option using kong 9080 it though works. But want to know wht am missing as to why its failing without proto option

:~# ./grpcurl -v -d '{"name": "Kong 1.3!"}' -plaintext localhost:50051 helloworld.Greeter/SayHello

Resolved method descriptor: rpc SayHello ( .helloworld.HelloRequest ) returns ( .helloworld.HelloReply );

Request metadata to send: (empty)

Response headers received: accept-encoding: identity,gzip content-type: application/grpc grpc-accept-encoding: identity,deflate,gzip

Response contents: { "message": "Hello, Kong 1.3!!" }

Response trailers received: (empty) Sent 1 request and received 1 response

:~# ./grpcurl -v -d '{"name": "Kong 1.3!"}' -plaintext localhost:9080 helloworld.Greeter/SayHello

Error invoking method "helloworld.Greeter/SayHello": failed to query for service descriptor "helloworld.Greeter": server does not support the reflection API

javadev
  • 41
  • 2

1 Answers1

2

When a proto isn't specified, grpcurl will attempt to obtain the interface and data definitions from the server. It does so by calling the gRPC reflection service. As such, on the Kong side, you need to ensure that the reflection request is also properly routed to the upstream gRPC service. You can set up, e.g., two routes, one matching the reflection service -- the path will look something like `grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo -- and the other matching the actual gRPC methods you want to proxy.

  • Thanks. When added multiple routes one with ServerReflectionInfo as you suggested above worked. But do we always need to add serverreflection in all grpc services? – javadev Jan 29 '22 at 14:50
  • 2
    "do we always need to add serverreflection in all grpc services?" yes, if you want to support reflection, you have to expose the endpoint used to support reflection – Javier Jan 29 '22 at 16:37