pantsel / kong-middleman-plugin

A Kong plugin that enables you to make an extra HTTP POST request before calling an API.
MIT License
156 stars 63 forks source link

kong.response.send() #21

Open anassolanki opened 4 years ago

anassolanki commented 4 years ago

Getting this error when status code arrives greater than 299:

2020/01/09 09:51:36 [error] 29977#0: 180219 [lua] access.lua:117: execute(): [middleman]" 2020/01/09 09:51:36 [error] 29977#0: 180219 lua coroutine: runtime error: /usr/local/share/lua/5.1/kong/plugins/middleman/access.lua:118: attempt to call field 'send' (a nil value) stack traceback: coroutine 0: /usr/local/share/lua/5.1/kong/plugins/middleman/access.lua: in function 'execute' /usr/local/share/lua/5.1/kong/plugins/middleman/handler.lua:14: in function </usr/local/share/lua/5.1/kong/plugins/middleman/handler.lua:12> coroutine 1: [C]: in function 'resume' coroutine.wrap:21: in function /usr/local/share/lua/5.1/kong/init.lua:680: in function 'access'

anassolanki commented 4 years ago

https://docs.konghq.com/1.4.x/pdk/kong.response/#kongresponseexitstatus-body-headers

Replace send method with exit in file access.lua and it works.

for e.g return kong_response.send(status_code, response_body) ==> older one return kong_response.exit(status_code, response_body) ==> New one

sagarpandav commented 4 years ago

Worked for us.