Skip to content

Fields marked as repeated are truncated #61

@adamthesax

Description

@adamthesax

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions