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 2022/01/20 10:55:36 UTC

[GitHub] [apisix] shuaijinchao opened a new issue #6167: bug: request exception when GraphQL route does not send body

shuaijinchao opened a new issue #6167:
URL: https://github.com/apache/apisix/issues/6167


   ### Issue description
   
   as shown in the title
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - 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):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   
   
   ### Steps to reproduce
   
   1、setting GraphQL route
   ```bash
   curl http://127.0.0.1:9080/apisix/admin/routes/11 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "methods": ["POST"],
       "uri": "/graphql",
       "vars": [
           ["graphql_operation", "==", "query"],
           ["graphql_name", "==", "getRepo"],
           ["graphql_root_fields", "has", "owner"]
       ],
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:1980": 1
           }
       }
   }'
   ```
   
   2、send request (no body)
   ```bash
   curl -X POST http://127.0.0.1:9080/graphql
   ```
   
   ### Actual result
   
   ```bash
   $ curl -X POST http://127.0.0.1:9080/graphql -i
   HTTP/1.1 500 Internal Server Error
   Date: Thu, 20 Jan 2022 10:50:53 GMT
   Content-Type: text/html; charset=utf-8
   Transfer-Encoding: chunked
   Connection: close
   Server: APISIX/2.11.0
   
   <!DOCTYPE html>
   <html>
   <head>
   <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
   <meta content="utf-8" http-equiv="encoding">
   <title>500 Internal Server Error</title>
   <style>
       body {
           width: 35em;
           margin: 0 auto;
           font-family: Tahoma, Verdana, Arial, sans-serif;
       }
   </style>
   </head>
   <body>
   <h1>An error occurred.</h1>
   <p>You can report issue to <a href="https://github.com/apache/apisix/issues">APISIX</a></p>
   <p><em>Faithfully yours, <a href="https://apisix.apache.org/">APISIX</a>.</em></p>
   </body>
   </html>
   ```
   
   ### Error log
   
   ```bash
   2022/01/20 10:50:53 [error] 197234#0: *265 lua entry thread aborted: runtime error: /srv/github.com/apache/apisix/apisix/core/ctx.lua:56: attempt to concatenate local 'err' (a nil value)
   stack traceback:
   coroutine 0:
   	/srv/github.com/apache/apisix/apisix/core/ctx.lua: in function 'parse_graphql'
   	/srv/github.com/apache/apisix/apisix/core/ctx.lua:78: in function 'get_parsed_graphql'
   	/srv/github.com/apache/apisix/apisix/core/ctx.lua:218: in function '__index'
   	....com/apache/apisix//deps/share/lua/5.1/resty/expr/v1.lua:291: in function 'eval'
   	...om/apache/apisix//deps/share/lua/5.1/resty/radixtree.lua:571: in function 'match_route_opts'
   	...om/apache/apisix//deps/share/lua/5.1/resty/radixtree.lua:641: in function 'match_route'
   	...om/apache/apisix//deps/share/lua/5.1/resty/radixtree.lua:709: in function 'dispatch'
   	/srv/github.com/apache/apisix/apisix/http/route.lua:112: in function 'match'
   	/srv/github.com/apache/apisix/apisix/init.lua:386: in function 'http_access_phase'
   	access_by_lua(nginx.conf:268):2: in main chunk, client: 127.0.0.1, server: _, request: "POST /graphql HTTP/1.1", host: "127.0.0.1:9080"
   ```
   
   ### Expected result
   
   ### response
   ```bash
   $ curl -X POST http://127.0.0.1:9080/graphql -i
   HTTP/1.1 404 Not Found
   Date: Thu, 20 Jan 2022 10:53:04 GMT
   Content-Type: text/plain; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/2.11.0
   
   {"error_msg":"404 Route Not Found"}
   ```
   
   ### error_log
   ```bash
   2022/01/20 10:53:04 [error] 197701#0: *327 [lua] ctx.lua:80: get_parsed_graphql(): failed to read graphql body: failed to read body, client: 127.0.0.1, server: _, request: "POST /graphql HTTP/1.1", host: "127.0.0.1:9080"
   ```


-- 
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 #6167: bug: request exception when GraphQL route does not send body

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


   


-- 
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 #6167: bug: request exception when GraphQL route does not send body

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


   


-- 
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