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/03/15 12:51:41 UTC

[GitHub] [apisix] rpei2022 opened a new issue #6620: bug:

rpei2022 opened a new issue #6620:
URL: https://github.com/apache/apisix/issues/6620


   ### Current Behavior
   
   when I have a try to send a http request to apisix via postman, I get the following response from apisix.
   <!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>
   
   and I find the following errors int the apisix error.log.
   
   2022/03/14 13:08:43 [error] 44#44: *204353 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/api_router.lua:99: bad argument #1 to 'ipairs' (table expected, got nil)
   stack traceback:
   coroutine 0:
           [C]: in function 'ipairs'
           /usr/local/apisix/apisix/api_router.lua:99: in function 'create_obj_fun'
           /usr/local/apisix/apisix/core/lrucache.lua:91: in function 'global'
           /usr/local/apisix/apisix/api_router.lua:160: in function 'match'
           /usr/local/apisix/apisix/init.lua:380: in function 'http_access_phase'
   
   
   
   
   
   ### Expected Behavior
   
   I expect to get correct response with no apisix internal  error.
   
   ### Error Logs
   
   2022/03/14 13:08:43 [error] 44#44: *204353 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/api_router.lua:99: bad argument #1 to 'ipairs' (table expected, got nil)
   stack traceback:
   coroutine 0:
           [C]: in function 'ipairs'
           /usr/local/apisix/apisix/api_router.lua:99: in function 'create_obj_fun'
           /usr/local/apisix/apisix/core/lrucache.lua:91: in function 'global'
           /usr/local/apisix/apisix/api_router.lua:160: in function 'match'
           /usr/local/apisix/apisix/init.lua:380: in function 'http_access_phase'
   
   ### Steps to Reproduce
   
   1. Run apisix with the docker-compose
   2. add the example-plugin as the procedure in this webline(https://github.com/apache/apisix/blob/master/docs/zh/latest/plugin-develop.md)
   3. add the following code in the example-plugin.lua
   function _M.api()
       return {
           {
               methods = {"GET"},
               uris = {"/v1/plugin/example-plugin/hello"},
               handler = hello,
           }
       }
   end
   4. add one upstream,  the configuration is as the following:
   {
     "nodes": [
       {
         "host": "www.baidu.com",
         "port": 80,
         "weight": 1
       }
     ],
     "timeout": {
       "connect": 6,
       "send": 6,
       "read": 6
     },
     "type": "roundrobin",
     "scheme": "http",
     "pass_host": "pass",
     "name": "moses_test_upstream_1_baidu",
     "keepalive_pool": {
       "idle_timeout": 60,
       "requests": 1000,
       "size": 320
     }
   }
   5. add one route with the follwoing configuration:
   {
     "uri": "/baidu/*",
     "name": "moses_test_route_1",
     "methods": [
       "GET",
       "POST",
       "PUT",
       "DELETE",
       "PATCH",
       "HEAD",
       "OPTIONS",
       "CONNECT",
       "TRACE"
     ],
     "plugins": {
       "prometheus": {
         "disable": false,
         "prefer_name": true
       }
     },
     "upstream_id": "398853061142905944",
     "status": 1
   }
   6. send the following request with postman
   http://xxx.xxx.xxx.xxx:9080/baidu/link?url=WPc1Tjj5YpzAQ_cRspO9tJcfmQNpPw6KZ2QHflmZ5GwqtFr06A9sKAt8rWoDOfGpzIEBC5mrz46eOOo6kdUh1jHdgWPyTq17o3aPdlEHQT1Phkg6zGJGRSiW4Af1-_GoYAtXTVX91Qn12GgQPi8ORRJQA7VbDPkb0G-LFSPfiGNtDbSeEqd_hhV0jCbHWKotyf7EmLbS4-dy1pDIkcvG3j9Baql7iV8dUT687BpEfx_Z5i4N2DrWTPuhGVlGSC1-2Ds3xhTlyZc5ZB-hy722ekC9NDxs15zeCD8frxBlIlu&wd=&eqid=dc8985310004f59700000002622fe34b
   
   ### Environment
   
   -apache/apisix:2.12.1-alpine
   - Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
   
   


-- 
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] rpei2022 removed a comment on issue #6620: bug: return internal server error for http request

Posted by GitBox <gi...@apache.org>.
rpei2022 removed a comment on issue #6620:
URL: https://github.com/apache/apisix/issues/6620#issuecomment-1068651966


   > example
   
   Thanks, I will make a update 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.

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

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



[GitHub] [apisix] rpei2022 commented on issue #6620: bug: return internal server error for http request

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


   > > function _M.api()
   > > return {
   > > {
   > > methods = {"GET"},
   > > uris = {"/v1/plugin/example-plugin/hello"},
   > > handler = hello,
   > > }
   > > }
   > > end
   > 
   > Please read the document carefully, it's not `uris` but `uri`.
   
   I just copy the code in  the example-plugin.lua, because example-plugin.lua has the following code, could you explain the difference?
   function _M.control_api()
       return {
           {
               methods = {"GET"},
               uris = {"/v1/plugin/example-plugin/hello"},
               handler = hello,
           }
       }
   end
   


-- 
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 commented on issue #6620: bug: return internal server error for http request

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


   > > > function _M.api()
   > > > return {
   > > > {
   > > > methods = {"GET"},
   > > > uris = {"/v1/plugin/example-plugin/hello"},
   > > > handler = hello,
   > > > }
   > > > }
   > > > end
   > > 
   > > 
   > > Please read the document carefully, it's not `uris` but `uri`.
   > 
   > Thanks for your reply, I just copy the code in the example-plugin.lua and make small change(change the function name), because example-plugin.lua has the following code, could you explain the difference? function _M.control_api() return { { methods = {"GET"}, uris = {"/v1/plugin/example-plugin/hello"}, handler = hello, } } end
   
   I think it's a bug in the example-plugin, welcome to fix it.


-- 
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 #6620: bug: return internal server error for http request

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


   


-- 
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] rpei2022 commented on issue #6620: bug: return internal server error for http request

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


   > example
   
   Thanks, I will make a update 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.

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 #6620: bug: return internal server error for http request

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


   


-- 
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 commented on issue #6620: bug: return internal server error for http request

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


   > function _M.api()
   return {
   {
   methods = {"GET"},
   uris = {"/v1/plugin/example-plugin/hello"},
   handler = hello,
   }
   }
   end
   
   Please read the document carefully, it's not `uris` but `uri`.


-- 
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] rpei2022 edited a comment on issue #6620: bug: return internal server error for http request

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


   > > function _M.api()
   > > return {
   > > {
   > > methods = {"GET"},
   > > uris = {"/v1/plugin/example-plugin/hello"},
   > > handler = hello,
   > > }
   > > }
   > > end
   > 
   > Please read the document carefully, it's not `uris` but `uri`.
   
   Thanks for your reply, I just copy the code in  the example-plugin.lua and make small change(change the function name), because example-plugin.lua has the following code, could you explain the difference?
   function _M.control_api()
       return {
           {
               methods = {"GET"},
               uris = {"/v1/plugin/example-plugin/hello"},
               handler = hello,
           }
       }
   end
   


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