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

ERROR: requires length-delimited wire type #94

Closed
HT808s opened this issue Mar 27, 2019 · 4 comments
Closed

ERROR: requires length-delimited wire type #94

HT808s opened this issue Mar 27, 2019 · 4 comments

Comments

@HT808s
Copy link

HT808s commented Mar 27, 2019

Hello !
I looked over the internet but so far I haven't seen an error like this elsewhere.

I get this when grpcurl tries to decode the response of my server.

ERROR:
  Code: Internal
  Message: grpc: failed to unmarshal the received message bad input; field api.Foo.UpdateTS requires length-delimited wire type

This field in question is of type google.protobuf.Timestamp.

Is there any chance you know what is going on and how I can fix this?

Cheers!

@jhump
Copy link
Contributor

jhump commented Mar 27, 2019

@HT808s, are you using server reflection, or are you pointing grpcurl at your proto source files? If the latter, maybe it is possible that your are pointing grpcurl at different protos than were used to build the server?

This error indicate that the server is not using the same protocol. A google.protobuf.Timestamp is a nested message, and message fields use the "length-delimited" wire type to encode the field value (vs. "varint", "fixed32", or "fixed64" wire types that other field types use). The server is sending back a response where that field number is encoded with one of these other wire types. This usually indicates that the server is using a different protocol than the client.

Maybe you changed the protocol from an int64 milliseconds-since-epoch to a google.protobuf.Timestamp, but forgot to recompile the server?

@jhump
Copy link
Contributor

jhump commented Mar 27, 2019

If you use server reflection, problems like this should go away since you can be certain that grpcurl uses the same protocol as the server.

If you are using server reflection, can you tell us more info? Maybe share the .proto file that defines the service and also let me know what language/runtime the server is written in?

@HT808s
Copy link
Author

HT808s commented Mar 27, 2019

Thanks for your reply!
I don't rely on reflection, I used a protoset file, I'll double check if I used the same proto file version for my server and grpcurl

@HT808s
Copy link
Author

HT808s commented Mar 27, 2019

There was indeed a subtle difference between the proto server side and grpcurl side !
Thanks for giving me a lead on this error !

@HT808s HT808s closed this as completed Mar 27, 2019
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