grpc/grpc-node

Server Reflection does not handle reserved keyword

anushkadoyan opened this issue · 0 comments

Problem description

Using ReflectionService from @grpc/reflection, and a .proto with a message "reserved 2", I get this error on grpcurl and also from python's grpcio-reflection:

Failed to list methods for service "testservice.TestService": proto: message "testservice.Test" reserved ranges has invalid range: 2 to 1

No issue with grpcurl 1.8.7, but present on 1.8.9. No issues with grpc client using grpc-js-reflection-client

Reproduction steps

server.js:

  const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
    keepCase: true,
    longs: String,
    enums: String,
    defaults: false,
    oneofs: false,
  });

  const testService = grpc.loadPackageDefinition(packageDefinition);

  // Define the server
  const server = new grpc.Server();
  const reflection = new ReflectionService(packageDefinition);

  reflection.addToServer(server);

test.proto:

syntax = "proto3";

package testservice;

message Test {
    string something = 1;
    reserved 2;
}

message GetTest {
    Test the_test = 1;
}

message Empty {}

service TestService {
    rpc GetTest(Empty) returns (Test) {}
}
grpcurl -plaintext localhost:8080 list testservice.TestService
Failed to list methods for service "testservice.TestService": proto: message "testservice.Test" reserved ranges has invalid range: 2 to 1`

Environment

  • MacOS Monterey 12.1, Apple M1 Pro
  • Node version 20.11.0
  • Node installation method nvm
  • Package name and version @grpc/grpc-js@1.10.5