Questions tagged [grpc-gateway]
68 questions
3
votes
1 answer
Grpc-gateway make strange wrapping of com.google.protobuf.wrappers.StringValue result
I have GRPC service with the following function:
rpc StreamMessages(StreamMessagesRequest) returns (stream google.protobuf.StringValue) {
option (google.api.http) = {
post: "/messages:stream"body: "*"
};
}
With grpc-gateway behind…

Alex Volmir
- 121
- 1
- 7
3
votes
2 answers
grpc-gateway runtime version conflict
from last few days the protoc generator is generating code with v2 version of github.com/grpc-ecosystem/grpc-gateway. I want to keep using github.com/grpc-ecosystem/grpc-gateway v1.16.0. I am unable to remove the v2 version which is causing…

Jyoti Kumari
- 61
- 5
3
votes
0 answers
bazel with protobuf / gRPC-gateway / golang - getting started
So I am trying to convert a monorepo of micro services (C#, Go, NodeJS) to use bazel. Just playing with it for now.
I focus on one go service to get started and isolated it as a WORKSPACE.
The go service is gRPC service that uses protobuf obviously,…

Jon
- 835
- 8
- 17
3
votes
1 answer
How to send response message with non-ok status from a python service behind grpc-gateway?
I'm writing a grpc service behind grpc-gateway in python and In case of too many request by some user I want to raise a 429 response and give the captcha-token in body of response message.
Actually my problem is when I use the block of code below…

Ali Ahmadi
- 31
- 1
- 3
3
votes
0 answers
grpc-gateway: return 201 on successful POST
What's the idiomatic way to return an HTTP 201 on a successful POST with grpc-gateway?
Writing a filter function seemed promising, but I'm not sure how to do this generically since I don't have access to the request (and can't determine the HTTP…

DMac the Destroyer
- 5,240
- 6
- 36
- 56
2
votes
0 answers
runtime.WithForwardResponseOption not used when terminating from UnaryServerInterceptor
I've setup a grpc-gateway for a small testbed service and I have a UnaryServerInterceptor setup that checks authorization bearer tokens and validate against an SSO introspection URL.
func (im *Middleware) GRPCAuthenticator()…

Odinovsky
- 551
- 1
- 6
- 23
2
votes
0 answers
How to get custom header from metadata of incoming request in grpc-gateway
Here is my CORS policy set to have a custom header
return http.ListenAndServe(":"+port,
handlers.CORS(handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization","Custom-header"}),
…

Shehzab Ahammad
- 117
- 8
2
votes
2 answers
How can I get the grpc gateway rest request response in protobuf?
I am using gRPC gateway for the backward compatibility support but I encountered an issue where in our REST APIs we are using the Protobuf with REST. But in gRPC gateway we are using JSON as a response type.
Now when we have migrated towards gRPC,…

MOHAMMAD ARSHAD
- 21
- 4
2
votes
1 answer
How to represent golang "any" type in protobuf language
am using a protobuf definition file to create golang classes
file.proto
message my_message {
data = 1 [json_name = "data"]
}
generated.go
type MyMessage struct {
data any
}
I have checked out Struct , Value and Any, though…

SpartanX1
- 201
- 2
- 8
2
votes
1 answer
grpc-gateway: redirect missmatch with the defination (proto file)
I use grpc-gateway to host REST api for my grpc service.
I'm have 2 api:
API A
option (google.api.http) = {
post: "/v1/product/{id}"
body: "*"
};
API B
option (google.api.http) = {
post: "/v1/product/unit"
body: "*"
…

Dang.Nguyen
- 83
- 1
- 7
2
votes
1 answer
grpc server and gateway shutdown order
my gRPC service uses grpc-gateway to serve http requests.
in order to make the service shutdown gracefully, is there an order i need to pay attention to? i.e. is the shutdown order
A. gRPC service -> gateway
B. gateway -> gRPC service
the only…

kimmy
- 21
- 1
2
votes
0 answers
Golang gRPC stream XML file (server-side)
The goal: When I open localhost:9000/xml page in the browser I would like to see xml content (which is large). I use gRPC server with grpc-gateway as a proxy.
To send my xml file I use server-side stream and send google.api.HttpBody message with…

Klimbo
- 1,308
- 3
- 15
- 34
2
votes
1 answer
gRPC-Gateway: Is there a way to return responses in form of JSON arrays?
I'm making an implementation of https://todobackend.com/ using gRPC-Gateway. https://todobackend.com/'s spec requires some responses to be in form of JSON arrays, like:
GET /todos
=> [{ "title": "...", ... }, { ... }]
But AFAIK by using…

wooseop
- 307
- 1
- 7
2
votes
1 answer
How to avoid copying vendor proto dependencies on buf generate
I am testing grpc-gateway and trying to figure out the best way to import dependencies in my grpc service. I have the following dir structure:
proto/
api.proto
api2.proto
third_party/
googleapis/
google/
api/
http.proto
…

taras
- 3,579
- 3
- 26
- 27
2
votes
3 answers
How to set a timeout in grpc-gateway?
How to set a timeout in grpc-gateway?
I want to limit the time the request is executed, where can I set a time limit? Do I need to create an "Interceptor" for this?

batazor
- 852
- 2
- 16
- 36