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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to