riskgod opened a new issue #4138:
URL: https://github.com/apache/apisix/issues/4138


   hey, I want to debug hmac-auth plugin, so I add one warn in line 310 in 
`hmac-auth.lua`
   
   ```
   if conf.signed_headers and #conf.signed_headers >= 1 then
           local headers_map = array_to_map(conf.signed_headers)
           core.log.warn("headers_map: ", headers_map)
           if params.signed_headers then
               for _, header in ipairs(params.signed_headers) do
                   if not headers_map[header] then
                       return nil, {message = "Invalid signed header " .. 
header}
                   end
               end
           end
       end
   ```
   
   But the apisix shows err
   
   ```
   2021/04/27 15:43:21 [error] 4820#29392: *444 lua entry thread aborted: 
runtime error: /Users/sh07016ml/chenjh/apisix/apisix/plugins/hmac-auth.lua:311: 
bad argument #2 to 'warn' (expected table to have __tostring metamethod)
   stack traceback:
   coroutine 0:
        [C]: in function 'warn'
        /Users/sh07016ml/chenjh/apisix/apisix/plugins/hmac-auth.lua:311: in 
function 'validate'
        /Users/sh07016ml/chenjh/apisix/apisix/plugins/hmac-auth.lua:404: in 
function 'phase_func'
        /Users/sh07016ml/chenjh/apisix/apisix/plugin.lua:673: in function 
'run_plugin'
        /Users/sh07016ml/chenjh/apisix/apisix/plugin.lua:718: in function 
'run_global_rules'
        /Users/sh07016ml/chenjh/apisix/apisix/init.lua:325: in function 
'http_access_phase'
        access_by_lua(nginx.conf:236):2: in main chunk, client: 127.0.0.1, 
server: _, request: "POST /checkAddress 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.

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


Reply via email to