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

Unable to deserialise message sent in grpc-status-details-bin #799

Closed
huysamen opened this issue Nov 6, 2020 · 2 comments
Closed

Unable to deserialise message sent in grpc-status-details-bin #799

huysamen opened this issue Nov 6, 2020 · 2 comments

Comments

@huysamen
Copy link

huysamen commented Nov 6, 2020

Following the practice of sending rich errors in the metadata trailer:

return nil, status.ErrorProto(
	&spb.Status{
		Code:    int32(codes.InvalidArgument),
		Message: "some message",
		Details: []*anypb.Any{a},    // with `a` pointing to some instance of a message defined in proto
	},
)

In the response the grpc-status-details-bin is a base64 version of the details data, but it does not seem to be in the same format normal messages are returned. Therefore, it is impossible to deserialise the data into something meaningful, in turn making it impossible to do rich errors.

@johanbrandhorst
Copy link
Contributor

Are you using https://pkg.go.dev/github.com/golang/protobuf/ptypes#MarshalAny or https://pkg.go.dev/google.golang.org/protobuf@v1.25.0/types/known/anypb#MarshalFrom to marshal your message type into any.Any? Secondly, how are you attempting to decode the details? There's a discussion in grpc/grpc-web#399 (comment) on how to unmarshal the details.

What are you suggesting the problem is exactly? With the client? The proxy?

@huysamen
Copy link
Author

huysamen commented Nov 6, 2020

Ah great, thanks @johanbrandhorst - the double deserialization did the trick.

@huysamen huysamen closed this as completed Nov 6, 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