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

No pattern specified in google.api.HttpRule #70

Closed
pgracio opened this issue Dec 9, 2015 · 9 comments
Closed

No pattern specified in google.api.HttpRule #70

pgracio opened this issue Dec 9, 2015 · 9 comments

Comments

@pgracio
Copy link

pgracio commented Dec 9, 2015

Hi,

I'm starting using grpc-gateway and this is probably a newbie question.

When running this I'm getting the following error. Probably missing something...

~/github/grpc-gateway (master)$ protoc -I/usr/local/include -I.  -I$GOPATH/src  -I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis  --grpc-gateway_out=logtostderr=true:.  examples/examplepb/echo_service.proto
E1209 15:00:22.665743   18512 services.go:107] No pattern specified in google.api.HttpRule: Echo

Thanks,
Paulo Grácio

@mtsgrd
Copy link

mtsgrd commented Dec 9, 2015

+1

@ghost
Copy link

ghost commented Dec 10, 2015

I am facing a similar issue. I also noticed that the problem did not occur on a different computer with "same" setup steps. Here is a contrived example that shows how to reproduce this issue:

First I modified the Makefile to avoid the google/http issue (#67):

$ cd $GOPATH/src/github.com/gengo/grpc-gateway

$ nano Makefile
examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS)
    sed -i "s/import _ \"google\/api\"//" ./examples/**/*.pb.go

$ make test

Test run successfully. Now I undo all the changes made by make test. This reverts the generated files back to their original version.

$ git reset HEAD --hard

Now, if I run make test, I get the following error:

$ make test
go build -o bin/protoc-gen-grpc-gateway github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
protoc -I /usr/local/bin//../include -I. -Ithird_party/googleapis --plugin=bin/protoc-gen-grpc-gateway --grpc-gateway_out=logtostderr=true,Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/gengo/grpc-gateway/examples/sub:. examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto examples/examplepb/flow_combination.proto
E1210 06:26:49.972372    7693 services.go:107] No pattern specified in google.api.HttpRule: Echo
--grpc-gateway_out: none of pattern specified
make: *** [examples/examplepb/echo_service.pb.gw.go] Error 1

If I run make realclean (and add the google/http sed rule) and then run make test, everything works again. @yugui, can you please help us fix this issue?

@yugui
Copy link
Member

yugui commented Dec 10, 2015

I'm trying to investigate the issue.

There are some quick updates:

  • I am not sure why make test works fine. But protoc-gen-grpc-gateway fails to load message descriptor correctly. When it loads your message descriptor, the descriptor actually lacks http path mapping even though you specified it in .proto file.
  • Another possibly related thing is that proto.MarshalText and proto.UnmarshalText don't roundtrip for oneof fields.
  • protoc warns [libprotobuf WARNING google/protobuf/compiler/parser.cc:492] No syntax specified for the proto file. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.) when I see this issue.

@yugui
Copy link
Member

yugui commented Dec 10, 2015

The root cause was that generated third_party/googleapis/google/api/*.pb.go were incompatible to recent github.com/golang/protobuf.
#71 will fix this issue.

@ghost
Copy link

ghost commented Dec 10, 2015

Thank you @yugui for looking into this quickly. Please merge #71 into master.

@yugui
Copy link
Member

yugui commented Dec 10, 2015

merged.

@ghost
Copy link

ghost commented Dec 10, 2015

Thanks @yugui . Everything is working here. For someone checking this issue, the fix was:

  • Update grpc-gateway (go get -u ...)
  • Update protoc build command to include the correct path for google/api
--go_out=Mgoogle/api/annotations.proto=github.com/gengo/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:.

@mtsgrd
Copy link

mtsgrd commented Dec 10, 2015

Thanks @yugui, you're a star!

@pgracio
Copy link
Author

pgracio commented Dec 10, 2015

Thanks @yugui this works like a charm!

@yugui yugui closed this as completed Jan 5, 2016
taihaofu pushed a commit to tronprotocol/grpc-gateway that referenced this issue Jun 26, 2018
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

3 participants