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

Metadata empty on RPCError #370

Closed
codesuki opened this issue Sep 7, 2022 · 3 comments
Closed

Metadata empty on RPCError #370

codesuki opened this issue Sep 7, 2022 · 3 comments

Comments

@codesuki
Copy link

codesuki commented Sep 7, 2022

Hi there! Great job with the library!

I am playing around and wanted to test a bit more complex gRPC errors.

	st, err := st.WithDetails(&somepb.Something{Something: "some details"})
	return nil, st.Err()

Now I was expecting to find the Something message attached in the metadata or similar field on the RpcError. But it's always empty. What I get is something like this RpcError{code: "ABORTED", name: "RpcError", message: "aborted", metadata: {}}

There might be other layers affecting the outcome of this like some Envoy setting or whatnot. Does anyone successfully use this feature or could try in their setup if it works?

@timostamm
Copy link
Owner

Hey @codesuki, apologies for the super late response 🙈

The error details are encoded in a header or trailer field grpc-status-details-bin. It is a google.rpc.Status message, base64 encoded.

This library does not attempt to parse the details, but you should be able to do so manually.

@timostamm
Copy link
Owner

Oh, I see that metadata is empty. If you are using gRPC-web, make sure the headers are CORS allowlisted. If the header still does not show up, this might be a bug in this library, and I'd be interested in a confirmation.

@codesuki
Copy link
Author

codesuki commented Feb 2, 2023

Yep, that was it! Totally forgot about the CORS settings. Thanks!

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