Skip to content

bug: failed to find proto by id in grpc-transcode plugin #8952

Description

@Baoyuantop

Current Behavior

When I was troubleshooting the issue apache/apisix-dashboard#2662, I found that the proto_id field of the grpc-transcode plugin is of type string/integer. but the strange thing is that when configured as string, everything is fine, and when configured as integer, APISIX shows the following error log:

2023/02/27 07:47:13 [error] 51#51: *377378 [lua] grpc-transcode.lua:146: phase_func(): proto load error: failed to find proto by id: 1, client: 172.19.0.1, server: _, request: "GET /grpctest HTTP/1.1", host: "127.0.0.1:9080"

Expected Behavior

The configuration should work correctly regardless of whether string or integer types are used. Otherwise, the documentation needs to be updated.

Error Logs

2023/02/27 07:47:13 [error] 51#51: *377378 [lua] grpc-transcode.lua:146: phase_func(): proto load error: failed to find proto by id: 1, client: 172.19.0.1, server: _, request: "GET /grpctest HTTP/1.1", host: "127.0.0.1:9080"

Steps to Reproduce

Follow the steps in https://apisix.apache.org/docs/apisix/plugins/grpc-transcode/#enabling-the-plugin

  1. Create proto resource
  2. Create Route with
curl http://127.0.0.1:9180/apisix/admin/routes/111 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "methods": ["GET"],
    "uri": "/grpctest",
    "plugins": {
        "grpc-transcode": {
            "proto_id": 1,
            "service": "helloworld.Greeter",
            "method": "SayHello"
        }
    },
    "upstream": {
        "scheme": "grpc",
        "type": "roundrobin",
        "nodes": {
            "127.0.0.1:50051": 1
        }
    }
}'

Environment

  • APISIX version (run apisix version): 3.1.0
  • Operating system (run uname -a): Linux cedc51dc68a5 5.15.49-linuxkit change: added doc of how to load plugin. #1 SMP Tue Sep 13 07:51:46 UTC 2022 x86_64 GNU/Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant: 3.0.0
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions