Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc-dump prints warning if message definition contains a map #89

Open
shinderuk opened this issue Mar 31, 2020 · 0 comments
Open

grpc-dump prints warning if message definition contains a map #89

shinderuk opened this issue Mar 31, 2020 · 0 comments
Assignees

Comments

@shinderuk
Copy link

WARN[0075] Failed to search for unknown fields in message =proto_decoder error="failed to enrich decode descriptor: unknown nested field type map[interface {}]interface {}"

Nevertheless map is dumped correctly.

Steps to reproduce:

  1. Start greeter_server
$ ~/go/bin/greeter_server
...
  1. Download helloworld.proto to proto/helloworld/helloworld.proto
  2. Edit helloworld.proto and add a map field to HelloRequest:
message HelloRequest {
  string name = 1;
  map<string, string> foo = 2;
}
  1. Start grpc-dump:
$ ~/go/bin/grpc-dump -port 8980 -destination localhost:50051 -proto_roots proto
...
  1. Call SayHello with grpc_cli, first without, then with a map:
$ grpc_cli -remotedb=false -proto_path proto -protofiles helloworld/helloworld.proto \
    call localhost:8980 helloworld.Greeter/SayHello 'name:"world"'
...
$ grpc_cli -remotedb=false -proto_path proto -protofiles helloworld/helloworld.proto \
    call localhost:8980 helloworld.Greeter/SayHello 'name:"world" foo{key:"abc" value:"123"}'
...
  1. grpc-dump prints warnings, but dumps everything correctly:
WARN[0003] Failed to search for unknown fields in message  =proto_decoder error="failed to enrich decode descriptor: unknown nested field type map[interface {}]interface {}"
{"service":"helloworld.Greeter","method":"SayHello","messages":[{"message_origin":"client","raw_message":"CgV3b3JsZA==","message":{"name":"world"},"timestamp":"2020-03-31T23:47:27.013997+03:00"},{"message_origin":"server","raw_message":"CgtIZWxsbyB3b3JsZA==","message":{"message":"Hello world"},"timestamp":"2020-03-31T23:47:27.014589+03:00"}],"metadata":{":authority":["localhost:8980"],"accept-encoding":["identity,gzip"],"content-type":["application/grpc"],"grpc-accept-encoding":["identity,deflate,gzip"],"user-agent":["grpc-c++/1.19.1 grpc-c/7.0.0 (osx; chttp2; gold)"],"via":["HTTP/2.0 127.0.0.1:8980"]},"metadata_response_headers":{"content-type":["application/grpc"]},"metadata_response_trailers":{}}
WARN[0075] Failed to search for unknown fields in message  =proto_decoder error="failed to enrich decode descriptor: unknown nested field type map[interface {}]interface {}"
{"service":"helloworld.Greeter","method":"SayHello","messages":[{"message_origin":"client","raw_message":"CgV3b3JsZBIKCgNhYmMSAzEyMw==","message":{"name":"world","foo":{"abc":"123"}},"timestamp":"2020-03-31T23:48:38.287028+03:00"},{"message_origin":"server","raw_message":"CgtIZWxsbyB3b3JsZA==","message":{"message":"Hello world"},"timestamp":"2020-03-31T23:48:38.28725+03:00"}],"metadata":{":authority":["localhost:8980"],"accept-encoding":["identity,gzip"],"content-type":["application/grpc"],"grpc-accept-encoding":["identity,deflate,gzip"],"user-agent":["grpc-c++/1.19.1 grpc-c/7.0.0 (osx; chttp2; gold)"],"via":["HTTP/2.0 127.0.0.1:8980"]},"metadata_response_headers":{"content-type":["application/grpc"]},"metadata_response_trailers":{}}

Workaround

In proto-files for grpc-dump replace map with repeated MapEntry field.
See: https://developers.google.com/protocol-buffers/docs/proto3#backwards-compatibility

@bradleyjkemp bradleyjkemp self-assigned this Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants