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

Try tower service hack #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Try tower service hack #2

wants to merge 4 commits into from

Conversation

liufuyang
Copy link
Owner

I was told to use something like this to do a "hack" in order to add grpc-timeout header onto the out going gRPC call.

And I also followed some code from this PR

But still this solution is not working for me?
The only thing that works for me is a tonic version that doesn't having grpc-timeout in the restrict list.

The output of my server looks like this with the PR change:

Server listening on [::1]:50052
call block req: {"content-type": "application/grpc", "user-agent": "grpcurl/1.8.0 grpc-go/1.30.0", "te": "trailers", "grpc-timeout": "5S"}
Got a request from Some([::1]:60981)
Request -> Request { metadata: MetadataMap { headers: {"grpc-timeout": "5S"} }, message: GetTrackRequest { gid: "3ff764c7c652446cbd79c05cfd8f59a7", country: "US", catalogue: "free", accept_language: [], preview: true, etag: [], view: Default }, extensions: Extensions }
interceptor block req: MetadataMap { headers: {"grpc-timeout": "5S", "spotify-userinfo-bin": "IgJ1c3IgY2RiM2EzOTA4NWEzNDg2MzkxZDA1NDIxMWUwZTUyOGM="} }

And the output of calling onto this server:

 grpcurl -plaintext -import-path ./proto -proto trackinfo.proto     -d '{"trackId": "1WHzHtbCV4OoB0TLgG7eMD"}'         localhost:50052 spotify.goldenpathexamples.GoldenPathExampleService/TrackToString
ERROR:
  Code: Aborted
  Message: No deadline specified

The reason is that the remote Spotify grpc server is requiring "grpc-timeout" in the header but I am not sure how to add it with the hack.

@liufuyang
Copy link
Owner Author

After putting the Timeout tower service onto the client side, it is working now :) 8bdf2da#diff-bf87a0176b8a8a226d4fc580badf7d9d0b45bdb0b8761d1f98a14ea531235512R25

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

Successfully merging this pull request may close these issues.

None yet

1 participant