Luacheck error setting non-standard global variable

I trying to read a JSON payload,
ngx.req.read_body()
body = ngx.req.get_body_data()
if not body then return no_json_content() end
data = json_decode(body)

When I running luacheck I am getting the below warning :
setting non-standard global variable data

To resolve that I am adding local to body variable, now the li=uacheck waring is resolved but I am getting an error while trying to read the file -
[error] 2179#0: *958 [lua] plugins_iterator.lua:165: load_plugin_configuration(): failed to get from node cache: receive_message: failed to get type: nil, client: 127.0.0.1, server: kong, request: “GET /filterPayload HTTP/1.1”, host: “localhost:8000”

Could you please suggest the fix!!


© 2018 Kong Inc.    Terms  •  Privacy  •  FAQ