Coder Social home page Coder Social logo

Comments (9)

mtsgrd avatar mtsgrd commented on June 22, 2024

+1

from grpc-gateway.

 avatar commented on June 22, 2024

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?

from grpc-gateway.

yugui avatar yugui commented on June 22, 2024

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.

from grpc-gateway.

yugui avatar yugui commented on June 22, 2024

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.

from grpc-gateway.

 avatar commented on June 22, 2024

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

from grpc-gateway.

yugui avatar yugui commented on June 22, 2024

merged.

from grpc-gateway.

 avatar commented on June 22, 2024

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:.

from grpc-gateway.

mtsgrd avatar mtsgrd commented on June 22, 2024

Thanks @yugui, you're a star!

from grpc-gateway.

pgracio avatar pgracio commented on June 22, 2024

Thanks @yugui this works like a charm!

from grpc-gateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.