Skip to content

bug: [405 Not Allowed] in grpc-transcode #4682

Description

@xtechcloud-admin

Issue description

Environment

Bug report without environment information will be ignored or closed.

  • apisix version (cmd: apisix version): apache/apisix:2.7-alpine (docker image)
  • OS (cmd: uname -a): Ubuntu 20.04
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API): bitnami/etcd:3.5.0 (docker images)
  • apisix-dashboard version, if have: none
  • luarocks version, if the issue is about installation (cmd: luarocks --version):

Minimal test code / Steps to reproduce the issue

Bug report without steps to reproduce will be ignored or closed.

follow the document https://apisix.apache.org/zh/docs/apisix/plugins/grpc-transcode
1.

curl http://127.0.0.1/apisix/admin/proto/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
  "content" : "syntax = \"proto3\";
  package helloworld;
  enum Gender {
    GENDER_UNKNOWN=0;
    GENDER_MALE=1;
    GENDER_FEMALE=2;
  }
  service Greeter {
    rpc SayHello (HelloRequest) returns (HelloReply) {}
  }
  message HelloRequest {
    string name = 1;
    Gender gender = 2;
  }
  message HelloReply {
    string message = 1;
  }"
}'
curl http://127.0.0.1/apisix/admin/routes/111 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "methods": ["POST"],
    "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
        }
    }
}'
curl -i  -X POST http://127.0.0.1/grpctest -d '{"name":"world"}'

What's the actual result? (including assertion message & call stack if applicable)

  • stdout
HTTP/1.1 405 Not Allowed
Date: Tue, 27 Jul 2021 10:21:43 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 154
Connection: close
Server: APISIX/2.7

<html>
<head><title>405 Not Allowed</title></head>
<body>
<center><h1>405 Not Allowed</h1></center>
<hr><center>openresty</center>
</body>
</html>
  • log/access.log
10.1.0.1 - - [27/Jul/2021:10:21:43 +0000] 127.0.0.1 "POST /grpctest HTTP/1.1" 405 154 0.019 "-" "curl/7.68.0" - - - "http://127.0.0.1"
  • log/error.log
2021/07/27 10:21:43 [error] 50#50: *125300 lua entry thread aborted: runtime error: stack overflow
stack traceback:
coroutine 0:
        [C]: in function 'req_read_body'
        /usr/local/apisix/apisix/core/request.lua:202: in function 'get_body'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:57: in function 'get_request_table'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:101: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        /usr/local/apisix/apisix/plugins/grpc-transcode/util.lua:104: in function 'map_message'
        ..., client: 10.1.0.1, server: _, request: "POST /grpctest HTTP/1.1", host: "127.0.0.1"

Everying is ok if i coment the enum field.

message HelloRequest {
    string name = 1;
    //Gender gender = 2;
  }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions