- https://apisix.apache.org/docs/apisix/plugins/grpc-transcode/
- Type: reference
- Source: Apache APISIX documentation (plugin
grpc-transcode)
TL;DR
The grpc-transcode plugin lets APISIX accept plain HTTP requests, call an upstream gRPC service from a registered .proto, and convert the reply back to HTTP.
What it covers
Attributes, registration of the proto, route setup and error handling for HTTP-to-gRPC transcoding in the APISIX gateway.
Key takeaways
- Register the proto through the Admin API (
/apisix/admin/protos/{id}); for imports, build a.pbdescriptor withprotoc --include_imports --descriptor_set_outand upload it base64-encoded. - Enable on a route with
proto_id,service(for exampleecho.EchoService) andmethod, and set the upstreamschemetogrpc. - Call it with HTTP: query parameters map to request message fields.
- Tune the encoding with
pb_option(enum_as_name,int64_as_string,auto_default_values, …); useint64_as_stringto avoid precision loss. - Handle errors: the response carries
grpc-statusandgrpc-messageand a matching HTTP code (for example 503 for status 14);show_status_in_bodyplusstatus_detail_typedecode details. - Limits:
deadline(ms) andmax_resp_body_size(default 64 MiB) bound a call.
Tools and concepts
| Item | Role in the page |
|---|---|
| Apache | APISIX is an Apache project |
| gRPC | Upstream protocol |
| API | HTTP/JSON façade over gRPC |
| protoc | Compiles descriptors for the proto resource |
When to use
- When exposing a gRPC backend to HTTP/JSON clients through APISIX.
- When you need the plugin attributes and the Admin API calls.
- When comparing with Google’s mapping approach in Transcoding HTTP-JSON to gRPC.
Caveats
- Mapping is by route and query parameters; there is no
google.api.httpannotation support described on this page.
gRPC API Apache Transcoding HTTP-JSON to gRPC Introducing gRPC Support with NGINX An Envoy-Powered, Kubernetes-Native API Gateway