grpc-web: undefined: transport.StreamFromContext
% go get -u github.com/improbable-eng/grpc-web/go/grpcwebproxy
# github.com/mwitkow/grpc-proxy/proxy
go/src/github.com/mwitkow/grpc-proxy/proxy/handler.go:63:30: undefined: transport.StreamFromContext
%
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (9 by maintainers)
For anyone stumbling here, this commit perfectly describes how to fix
undefined: transport.StreamFromContext
(or why there’s no bin file after go install): https://github.com/jfyne/docker-grpcwebproxy/commit/da712301bde103014e7becbac0fa298384bf622fFor example, I had this problem with http://github.com/improbable-eng/grpc-web, and the following worked:
After that
$GOPATH/bin/grpcwebproxy
was available.Using
dep
works for me. I posted my notes for building a Docker image if anyone is looking for a temporary option that’s easy to get running. I haven’t used it for anything more than a bit of playing around, so use it at your own risk.I just bumped into this issue as well this afternoon. I found a quick and dirty work-around that I thought I’d share in case anyone else is sufficiently blocked and/or impatient to make use of such until a genuine fix is incorporated.
After failing to “go get” grpcwebproxy with the transport.StreamFromContext undefined error message, I cd into my GOPATH’s staged copy of grpc-go:
cd $GOPATH/src/google.golang.org/grpc
There is a tag for the v1.10.1 release, the last one before this artifact was removed. I first tried simply checking out that tag…
git checkout v1.10.1
…but when I tried “go get” for grpcwebproxy in this state, the build failed with a complaint about that the google repository not being at the HEAD of master. I’m not planning on pushing this staging area back (I hope I wouldn’t have sufficient permissions to do so if I tried, but I’m not about to try it and see all the same), so I attempted a soft reset back to master with the content of v1.10.1 still in my workspace, then committed the deltas I’d carried over.
git reset --soft master
git commit -m 'Hack Back to v1.10.1 - DO NOT PUSH'
At this point, I was able to “go get” grpcwebproxy successfully. Go did not seem to care that my staged branch was one commit ahead of origin.