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

several problems with grpc context #29

Open
truhlik opened this issue Feb 5, 2020 · 1 comment
Open

several problems with grpc context #29

truhlik opened this issue Feb 5, 2020 · 1 comment

Comments

@truhlik
Copy link

truhlik commented Feb 5, 2020

Hi, I got several issues in nameko_grpc context/metadata processing.

  1. I don't see any reason why there is METADATA_PREFIX hardcoded? It causing problem, that all our custom headers have this prefix, which is not desired.

  2. There is not correctly working encoding values. Strings are encoded two times.

  3. There is definitely issue in context_data_from_metadata because there is decode_value(value) only in one part of if/else block. I am not sure, about what is correct, but for my case there should not be any decoding. I think that decode is already done by that time.

@mattbennett
Copy link
Member

Hi @truhlik,

Thank you for raising this. The metadata module was added quite hastily, so the issues you've found are not too surprising.

I think the confusion here is that Nameko has its own concept of context (context_data) and we are trying to persist that object through the gRPC headers. Each item in Nameko's context_data is JSON-serialised (whether it needs to be or not) because Nameko supports rich objects like lists in each key.

The METADATA_PREFIX is there so the context data object can be reconstructed on the other side if the target is a Nameko service.

This is the reason for the asymmetrical decode -- only keys with the METADATA_PREFIX have been JSON-encoded on the way in.

What are the problems you're having?

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