Comments (9)
+1
from grpc-gateway.
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.
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
andproto.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.
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.
Thank you @yugui for looking into this quickly. Please merge #71 into master.
from grpc-gateway.
merged.
from grpc-gateway.
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.
Thanks @yugui, you're a star!
from grpc-gateway.
Thanks @yugui this works like a charm!
from grpc-gateway.
Related Issues (20)
- Example and pattern annotations are not respect for query and path parameters HOT 8
- FieldMask as query param is not converted to snake case HOT 1
- an google.protobuf.Any type how to get openapiv2 output? HOT 1
- omit-enum-default-value Generates Invalid Spec for Enums with a Single Value HOT 1
- Content-Length not set in ForwardResponseMessage HOT 5
- Log level for errors is "info" HOT 5
- On `context deadline exceeded`, response headers aren't set HOT 3
- Add support for Etag & If-None-Match headers HOT 6
- TestOutgoingTrailerMatcher is non-deterministic
- How to remove @type or type_url after marshal google.protobuf.Any? HOT 3
- Feat: add http handler middleware HOT 1
- `X-Forwarded-For` header is not handled correctly HOT 2
- README.md: link to Wiki of "tool dependency" has been moved to go.dev HOT 1
- undefined: grpc.NewClient HOT 1
- proposal: Use version info from runtime/debug:BuildInfo when installed by go install HOT 2
- OpenAPI gen doesn't work default mapping. HOT 1
- buf: failed to read gRPC API Configuration description: no such file or directory HOT 1
- Moving protos out of protoc-gen-openapiv2/options directory to support Python HOT 1
- Grpc gateway project starter script HOT 1
- Support Service doc comments for OpenApi/Swagger generation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-gateway.