You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/03/20 13:50:20 UTC

[GitHub] [apisix] keenbo opened a new issue #3874: bug: [grpc transcode] Can not conver protobuf message's sub message from json input

keenbo opened a new issue #3874:
URL: https://github.com/apache/apisix/issues/3874


   ### Issue description
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.4
   * OS (cmd: `uname -a`):centos 8 
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   nginx version: openresty/1.19.3.1
   built by gcc 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC) 
   built with OpenSSL 1.1.1h  22 Sep 2020 (running with OpenSSL 1.1.1i  8 Dec 2020)
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.9 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/loca
 l/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --with-cc='ccache gcc -fdiagnostics-color=always' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-http_ssl_module
   
   * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):3.4.9
   * apisix-dashboard version, if have: no
   
   ### Minimal test code / Steps to reproduce the issue
   
   1.step 1: set correct proto and upstream svr
   ```
   curl http://127.0.0.1:9080/apisix/admin/proto/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "content" : "syntax = \"proto3\";
       package helloworld;
       service Greeter {
           rpc SayHello (HelloRequest) returns (HelloReply) {}
       }
       message Info {
         string id = 1;
         string msg = 2;
       }
       message HelloRequest {
         string name = 1;
         Info req_info = 2;
       }
       message HelloReply {
           string message = 1;
   	Info rsp_info = 2;
       }"
   }'
   
   curl http://127.0.0.1:9080/apisix/admin/routes/111 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "methods": ["GET","POST"],
       "uri": "/grpctest2",
       "plugins": {
           "grpc-transcode": {
               "proto_id": "1",
               "service": "helloworld.Greeter",
               "method": "SayHello"
           }
       },
       "upstream": {
           "scheme": "grpc",
           "type": "roundrobin",
           "nodes": {
               "192.168.155.111:5000": 1
           }
       }
   }'
   
   ```
   2.Use curl for requesting the upstream.
   ```
   curl -X POST  -H  "Content-Type:application/json"  -H "te:trailers" -i http://127.0.0.1:9080/grpctest2  \
   -d '{"name":"jack2","req_info":{"id":"id-001","msg":""}}'
   ```
   
   ### What's the actual result? (including assertion message & call stack if applicable)
   
   The grpc server should receive the *req_info* field successfully. But the grpc server do not received the field while processing the request. 
   
   The printed result of pb's DebugString() method looks like:
   ```
   name: "jack2"
   req_info {
   }
   ```
   
   ### What's the expected result?
   
   ```
   name: "jack2"
   req_info {
     id: "id-001",
    msg: ""
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] nic-chen commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-1061574703


   Last year, I emptied the GitHub Notifications once, so I failed to notice this issue since then. 
   I don't have much time on this project currently, can you guys help check and fix the issue? thanks! @bisakhmondal @shuaijinchao 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander closed issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #3874:
URL: https://github.com/apache/apisix/issues/3874


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] shuaijinchao commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
shuaijinchao commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-1061817753


   my test results are consistent with @bisakhmondal 
   ![image](https://user-images.githubusercontent.com/8529452/157254038-9765ee93-2ede-4476-b16b-c8ca02e07afb.png)
   cc @nic-chen 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] nic-chen commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-803683002


   > CC @nic-chen
   
   Thanks for reminding, find out the reason later
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-803556871


   @keenbo Does APISIX dumps any related error logs?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] bisakhmondal edited a comment on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
bisakhmondal edited a comment on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-1061610429


   Hi @keenbo, we are sorry you had to wait this long on this issue. Actually, we did a lot of refactoring in grpc transcode plugin lately. Could you please report if you are still facing the issue?
   I tried to reproduce the same, it works fine as expected. 
   
   Snippet of my server side code for the same proto you shared
   ```go
   func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
   	return &pb.HelloReply{
   		Message: in.Name,
   		RspInfo: in.ReqInfo,
   	}, nil
   }
   ```
   Here's the request to the apisix
   ```shell
   🔥➜ ~ curl -X POST  -H  "Content-Type:application/json"  -H "te:trailers" -i http://127.0.0.1:9080/grpctest2  \
   -d '{"name":"jack2","req_info":{"id":"id-001","msg":"it should work"}}'
   HTTP/1.1 200 OK
   Date: Tue, 08 Mar 2022 10:07:56 GMT
   Content-Type: application/json
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/2.12.0
   Trailer: grpc-status
   Trailer: grpc-message
   
   {"message":"jack2","rsp_info":{"id":"id-001","msg":"it should work"}}grpc-status: 0
   grpc-message: 
   ```
   
   Thanks!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-1064677124


   Consider solved. Feel free to reopen it if need.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers edited a comment on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
tokers edited a comment on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-803556871


   @keenbo Does APISIX dump any related error logs?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #3874: bug: [grpc transcoding] Can not conver protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-803514405


   CC @nic-chen 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-1060422614


   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 dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] bisakhmondal commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-1061610429


   Hi @keenbo, we are sorry you had to wait this long on this issue. Actually, we did a lot of refactoring in grpc transcoding lately. Could you please report if you are still facing the issue?
   I tried to reproduce the same, it works fine as expected. 
   
   Snippet of my server side code for the same proto you shared
   ```go
   func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
   	return &pb.HelloReply{
   		Message: in.Name,
   		RspInfo: in.ReqInfo,
   	}, nil
   }
   ```
   Here's the request to the apisix
   ```shell
   🔥➜ ~ curl -X POST  -H  "Content-Type:application/json"  -H "te:trailers" -i http://127.0.0.1:9080/grpctest2  \
   -d '{"name":"jack2","req_info":{"id":"id-001","msg":"it should work"}}'
   HTTP/1.1 200 OK
   Date: Tue, 08 Mar 2022 10:07:56 GMT
   Content-Type: application/json
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/2.12.0
   Trailer: grpc-status
   Trailer: grpc-message
   
   {"message":"jack2","rsp_info":{"id":"id-001","msg":"it should work"}}grpc-status: 0
   grpc-message: 
   ```
   
   Thanks!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] keenbo commented on issue #3874: bug: [grpc transcoding] Can not convert protobuf message's sub message from json input.

Posted by GitBox <gi...@apache.org>.
keenbo commented on issue #3874:
URL: https://github.com/apache/apisix/issues/3874#issuecomment-803761533


   > @keenbo Does APISIX dump any related error logs?
   
   No error dump in file */usr/local/apisix/logs/error.log* in the docker container.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org