grpc-proxy icon indicating copy to clipboard operation
grpc-proxy copied to clipboard

Fields marked as `repeated` are truncated

Open adamthesax opened this issue 3 years ago • 3 comments
trafficstars

While proxying messages that contain repeated fields, the values are truncated to only their last value. This happens both on incoming messages and the outgoing response. I created a simple test service that exhibits this behavior. Given a proto looks like:

service Greeter {
  rpc SayHelloAgain (HelloRequest) returns (RepeatedHelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

message RepeatedHelloReply {
  repeated string message = 1;
}

When I hit the gRPC service directly, I get an array of strings back:

$ grpcurl -plaintext -d '{"name": "Joe"}' localhost:50051 Greeter/SayHelloAgain
{
  "message": [
    "1: Hello Joe",
    "2: Hello Joe",
    "3: Hello Joe",
    "4: Hello Joe",
    "5: Hello Joe"
  ]
}

However making that same call via the proxy I get a truncated response:

grpcurl -plaintext -d '{"name": "Joe"}' localhost:50052 Greeter/SayHelloAgain
{
  "message": [
    "5: Hello Joe"
  ]
}

I've attached my example service that exhibits the behavior. The basic gRPC server runs on :50051 while the proxy runs on 50052. Use make run to start the service, and make test to hit the service to reproduce the issue. grpc-proxy-test.zip

Thanks in advanced for your assistance!

adamthesax avatar May 25 '22 14:05 adamthesax

+1

encountered the same problem and resolved by #62

snyh avatar Jun 14 '22 03:06 snyh

+1, I met the same problem.

wenfengwang avatar Jun 24 '22 14:06 wenfengwang

https://github.com/lengzhao/proxy This is an alternative. It is working all right

NexisDao avatar Sep 15 '22 06:09 NexisDao

+1, we're hitting this too and would appreciate #62 being merged if possible!

mattavos avatar Oct 27 '22 12:10 mattavos

+1 hitting this issue as well

floatingstatic avatar Nov 15 '22 02:11 floatingstatic