bug: protos do not parse in Stand Alone mode using the grpc-transcode plugin
Current Behavior
I am trying to run Stand-Alone mode using the grpc-transcode plugin with this apisix.yalm file:
protos:
-
id: 1
key: "/apisix/protos/1",
content: "syntax = \"proto3\";\npackage helloworld;\nservice Greeter {\nrpc SayHello (HelloRequest) returns (HelloReply) {}\n}\nmessage HelloRequest {\nstring name = 1;\n}\nmessage HelloReply {\nstring message = 1;\n}"
routes:
-
id: 1
uri: "/grpctest"
upstream:
scheme: "grpc"
nodes:
"host.docker.internal:50051": 1
type: roundrobin
scheme: "grpc"
methods: ["POST", "GET"]
plugins:
grpc-transcode:
method: "SayHello"
proto_id: 1
service: "helloworld.Greeter"
#END
And with this command:
curl -i -XPOST "http://127.0.0.1:9080/grpctest?name=world"
I am having this error because the proto is not being parsed:
docker-apisix-apisix-1 | 2023/03/27 07:14:11 [error] 136#136: *5231 [lua] grpc-transcode.lua:146: phase_func(): proto load error: failed to find proto by id: 1, client: 172.21.0.1, server: _, request: "POST /grpctest?name=world HTTP/1.1", host: "127.0.0.1:9080"
docker-apisix-apisix-1 | 172.21.0.1 - - [27/Mar/2023:07:14:11 +0000] 127.0.0.1:9080 "POST /grpctest?name=world HTTP/1.1" 501 5 0.041 "-" "curl/7.86.0" 192.168.65.2:50051 200 0.009 "grpc://127.0.0.1:9080"
Expected Behavior
Have the same behavior as here without the Stand-Alone mode.
Error Logs
docker-apisix-apisix-1 | 2023/03/27 07:14:11 [error] 136#136: *5231 [lua] grpc-transcode.lua:146: phase_func(): proto load error: failed to find proto by id: 1, client: 172.21.0.1, server: _, request: "POST /grpctest?name=world HTTP/1.1", host: "127.0.0.1:9080"
docker-apisix-apisix-1 | 172.21.0.1 - - [27/Mar/2023:07:14:11 +0000] 127.0.0.1:9080 "POST /grpctest?name=world HTTP/1.1" 501 5 0.041 "-" "curl/7.86.0" 192.168.65.2:50051 200 0.009 "grpc://127.0.0.1:9080"
Steps to Reproduce
- Checkout apisix-docker and in the example folder edit this files:
- config.yaml:
apisix:
node_listen:
- port: 9080
enable_http2: false
- port: 9084
enable_http2: true # APISIX listening port
enable_ipv6: false
enable_control: true
control:
ip: "0.0.0.0"
port: 9092
deployment:
role: data_plane
role_data_plane:
config_provider: yaml
plugin_attr:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091
- apisix.yalm:
protos:
-
id: 1
key: "/apisix/protos/1",
content: "syntax = \"proto3\";\npackage helloworld;\nservice Greeter {\nrpc SayHello (HelloRequest) returns (HelloReply) {}\n}\nmessage HelloRequest {\nstring name = 1;\n}\nmessage HelloReply {\nstring message = 1;\n}"
routes:
-
id: 1
uri: "/grpctest"
upstream:
scheme: "grpc"
nodes:
"host.docker.internal:50051": 1
type: roundrobin
scheme: "grpc"
methods: ["POST", "GET"]
plugins:
grpc-transcode:
method: "SayHello"
proto_id: 1
service: "helloworld.Greeter"
#END
- docker-compose-arm64.yml:
version: "3"
services:
apisix:
image: apache/apisix:3.1.0-debian
restart: always
volumes:
- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
- ./apisix_conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro
ports:
- "9180:9180/tcp"
- "9083:9083/tcp"
- "9084:9084/tcp"
- "9080:9080/tcp"
- "9091:9091/tcp"
- "9443:9443/tcp"
- "9092:9092/tcp"
networks:
apisix:
networks:
apisix:
driver: bridge
- docker-compose -p docker-apisix -f docker-compose-arm64.yml up
- curl -i -XPOST "http://127.0.0.1:9080/grpctest?name=world"
Environment
https://github.com/apache/apisix-docker/tree/master/example
It worked for me.
This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.