Skip to content

Blog post describing how to enable gRPC support in the latest Spring Cloud Gateway

Notifications You must be signed in to change notification settings

rrevyakin/spring-cloud-gateway-grpc

 
 

Repository files navigation

MCVE for Spring Cloud Gateway gRPC error

Start the server that is going to be listening to requests and always answer with not_found error:

 ./gradlew :grpc-server:bootRun

Then, start the gateway that is going to re-route the gRPC requests:

./gradlew :grpc-simple-gateway:bootRun

Finally, start the client that points to the gateway application:

./gradlew :grpc-client:bootRun

In client logs you will see this:

// Below receiving of message with error (grpc-status = 5 which means not-found) but for some reason stream is not closed: endStream = false
DEBUG 38436 --- [-worker-ELG-1-2] i.g.n.s.i.grpc.netty.NettyClientHandler  : [id: 0x66c97813, L:/127.0.0.1:54323 - R:localhost/127.0.0.1:8090] INBOUND HEADERS: streamId=3 headers=GrpcHttp2ResponseHeaders[:status: 200, x-request-header: header-value, trailer: grpc-status, content-type: application/grpc, grpc-status: 5, grpc-message: test exception] padding=0 endStream=false
// Then gateway sends second message just to close a stream: endStream=true
DEBUG 38436 --- [-worker-ELG-1-2] i.g.n.s.i.grpc.netty.NettyClientHandler  : [id: 0x66c97813, L:/127.0.0.1:54323 - R:localhost/127.0.0.1:8090] INBOUND HEADERS: streamId=3 headers=GrpcHttp2ResponseHeaders[grpc-status: 0] padding=0 endStream=true

It leads to "INTERNAL: No value received for unary call" instead of correct "NOT_FOUND: test exception".

About

Blog post describing how to enable gRPC support in the latest Spring Cloud Gateway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%