suryaparua-official opened a new issue, #13357:
URL: https://github.com/apache/apisix/issues/13357
### Current Behavior
In `apisix/plugins/limit-count/init.lua` at line 262, the `error()`
function is called with incorrect arguments:
error("failed to generate key invalid parent: ", core.json.encode(parent))
Lua's error(message, level) expects the second argument to be an integer
(stack level: 0, 1, or 2), not a string.
Passing core.json.encode(parent) as the level causes LuaJIT to raise:
bad argument #2 to 'error' (number expected, got string)
This crashes the request with an unhelpful LuaJIT internal error instead
of the intended error message about the invalid parent configuration.
### Expected Behavior
When conf._meta.parent is nil or missing resource_key, APISIX should log
a clear error message containing the JSON of the invalid parent object,
helping developers debug the issue quickly.
### Error Logs
bad argument #2 to 'error' (number expected, got string)
### Steps to Reproduce
1. Open apisix/plugins/limit-count/init.lua
2. Go to line 262
3. Observe the error() call:
error("failed to generate key invalid parent: ", core.json.encode(parent))
4. The second argument core.json.encode(parent) is a string, but Lua's
error() expects an integer as the second argument (stack level).
5. This path is triggered when conf._meta.parent is nil or
parent.resource_key is missing during limit-count plugin execution.
### Environment
APISIX version: master (3.16.0)
OS: Linux
OpenResty version: 1.29.2.3
File: apisix/plugins/limit-count/init.lua
Line: 262
--
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]