% 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
%
This was removed in a recent commit to grpc-go. See https://github.com/grpc/grpc-go/pull/1904#issuecomment-372087340. Apparently this API should not be used by external packages.
What is the sequence of steps that results in this problem? When building the project, I cannot reproduce the error outlined here.
Just go get -u github.com/improbable-eng/grpc-web/go/grpcwebproxy I think you have the old grpc-go lib already installed?
Maybe the problem is grpc-go itself and you happen the have the last working version?
% go get -u google.golang.org/grpc
% go get -u github.com/grpc/grpc-go
package github.com/grpc/grpc-go: code in directory /Users/gert/go/src/github.com/grpc/grpc-go expects import "google.golang.org/grpc"
%
Reproduced now. Had to delete my existing grpc-web to trigger it. This is a problem in a downstream dependency. Will investigate.
The dependencies of grpc-web are vendored so we should be able to use them directly without the impact of the grpc change. Cloning the repo directly or using dep should work
This is reproducable with a recent version of gRPC, so this repo needs to fix the use of a deprecated function _or_ ensure that gRPC versions are constrained to below 1.11. I'm in favor of the former, if possible.
I think if https://github.com/grpc/grpc-go/issues/2016 gets implemented this should be a fairly straightforward fix.
Is there a work-around or are we pretty much waiting for grpc-go at this point?
Use an older version of gRPC is the workaround.
https://github.com/grpc/grpc-go/issues/2016 might mean we can incorporate a fix for this here now.
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.
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.
grpc-proxy requires a small change in it's handler.go file to be compatible with the latest grpc-go.(There's also a PR for that).
[proposal]grpc-proxy is a small project and dependency - it might be worthwhile merging it into this project as a sub package, for example: improbable-eng/grpc-web/go/proxy. (this is what I was basically forced to do with caddy-grpc until the PR is merged ).
By doing that you can change the handler.go to be compatible with upstream grpc-go by implementing a change similar to the following: https://github.com/pieterlouw/caddy-grpc/blob/master/proxy/handler.go#L69-72
Also, by adding it to this project then it means this project is not dependent on grpc-proxy what appears to be a stale project at the moment.
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/da712301bde103014e7becbac0fa298384bf622f
For example, I had this problem with http://github.com/improbable-eng/grpc-web, and the following worked:
go get -u github.com/improbable-eng/grpc-web/go/grpcwebproxy
cd $GOPATH/src/github.com/improbable-eng/grpc-web
brew install dep # install golang/dep somehow
dep ensure
go get -u github.com/improbable-eng/grpc-web/go/grpcwebproxy
After that $GOPATH/bin/grpcwebproxy was available.
It seems this is no longer a problem with the vendored version of gRPC