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

undefined: transport.StreamFromContext #174

Closed
gertcuykens opened this issue Apr 21, 2018 · 15 comments
Closed

undefined: transport.StreamFromContext #174

gertcuykens opened this issue Apr 21, 2018 · 15 comments

Comments

@gertcuykens
Copy link

% 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
% 
@johanbrandhorst
Copy link
Contributor

This was removed in a recent commit to grpc-go. See grpc/grpc-go#1904 (comment). Apparently this API should not be used by external packages.

@easyCZ
Copy link
Contributor

easyCZ commented Apr 21, 2018

What is the sequence of steps that results in this problem? When building the project, I cannot reproduce the error outlined here.

@gertcuykens
Copy link
Author

Just go get -u github.com/improbable-eng/grpc-web/go/grpcwebproxy I think you have the old grpc-go lib already installed?

@gertcuykens
Copy link
Author

gertcuykens commented Apr 21, 2018

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"
% 

@easyCZ
Copy link
Contributor

easyCZ commented Apr 21, 2018

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

@johanbrandhorst
Copy link
Contributor

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.

@johanbrandhorst
Copy link
Contributor

I think if grpc/grpc-go#2016 gets implemented this should be a fairly straightforward fix.

@ravihugo
Copy link

Is there a work-around or are we pretty much waiting for grpc-go at this point?

@johanbrandhorst
Copy link
Contributor

Use an older version of gRPC is the workaround.

@johanbrandhorst
Copy link
Contributor

grpc/grpc-go#2016 might mean we can incorporate a fix for this here now.

@jheinnic
Copy link

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.

@ryanjaeb
Copy link

ryanjaeb commented May 3, 2018

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.

@pieterlouw
Copy link

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.

@trusktr
Copy link
Contributor

trusktr commented Aug 10, 2018

For anyone stumbling here, this commit perfectly describes how to fix undefined: transport.StreamFromContext (or why there's no bin file after go install): jfyne/docker-grpcwebproxy@da71230

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.

@johanbrandhorst
Copy link
Contributor

It seems this is no longer a problem with the vendored version of gRPC

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

8 participants