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

No support for err status with details #184

Open
jamesjwarren opened this issue Feb 15, 2018 · 4 comments
Open

No support for err status with details #184

jamesjwarren opened this issue Feb 15, 2018 · 4 comments

Comments

@jamesjwarren
Copy link

There doesn't seem to be any support for deserialising error status details, as implemented in the go grpc library. The StatusObject type here only supports details as a string.

The status details binary can be found in the metadata err.metadata.get('grpc-status-details-bin'). I've tried deserialising this as the expected protobuf message with no success, receiving the err goog.asserts.AssertionError Failure: Decoder hit an error. Presumably there is more to the binary.

I am curious as to why there is nothing around retrieving the status details in this libraries API if it is a standard feature of grpc?

@manu-st
Copy link

manu-st commented Sep 24, 2018

This has been an issue for me to. The stream seems to be a UTF-8 sequence of characters but it would be better to have a way to get the string representation of the details. Also, why not including them in the error's message?

@TLadd
Copy link
Contributor

TLadd commented Oct 19, 2018

I've run into this as well. In the spec, details is a google.protobuf.Any type: https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto#L91, but here it is a human-readable string.

@murgatroid99
Copy link
Member

That status.proto is a completely separate thing from the status objects in gRPC. The original question was asking about decoding the grpc-status-details-bin metadata value, which some services use to send status.proto objects.

@TLadd
Copy link
Contributor

TLadd commented Mar 6, 2019

Initially was running into goog.asserts.AssertionError as well, but figured out what I was doing wrong, and I believe have a working solution. I was attempting to deserialize grpc-status-details-bin to one of the error detail objects directly, when in fact, the data was a Status message. So I first needed to deserialize to a Status message and then unpack the details field array of Any messages into the error detail types.

Can see the approach in this package: https://github.com/stackpath/node-grpc-error-details. It's working for us deserializing grpc-status-details-bin on our node server sent in error responses from our go services.

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

4 participants