nic-chen opened a new issue #2045:
URL: https://github.com/apache/apisix/issues/2045


   ### Issue description
   config item `key` of plugin `key-auth` shouldn't be empty
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 1.5
   * OS: centos 7
   
   ### Minimal test code / Steps to reproduce the issue
   1. 
   curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "plugins":{
           "key-auth":{
           }
       },
       "username":"test"
   }'
   2.
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/*",
       "plugins":{
           "key-auth":{
           }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:80": 1
           }
       }
   }'
   
   3.
   curl http://127.0.0.1:9080/test -H 'apikey: 267c6cf0' -d 
'{"token":"3c3d3af8642e4d4d9439f9f1d317de92"}' -v
   
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   occur 500
   
   error log:
   `2020/08/11 07:29:13 [error] 24#24: *15975 lua entry thread aborted: runtime 
error: /usr/local/apisix/apisix/plugins/key-auth.lua:49: table index is nil`
   
   ### What's the expected result?
   normal respond
   
   


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


Reply via email to