Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.lua:685: nil passed to JSON:decode() #23

Open
anassolanki opened this issue Jan 31, 2020 · 3 comments
Open

json.lua:685: nil passed to JSON:decode() #23

anassolanki opened this issue Jan 31, 2020 · 3 comments

Comments

@anassolanki
Copy link

Can someone help me out to solve this error.

2020/01/31 10:28:31 [error] 2331#0: *1515852 [kong] init.lua:687 /usr/local/share/lua/5.1/kong/plugins/middleman/json.lua:685: nil passed to JSON:decode(), client: 127.0.0.1, server: kong, request

@apurvajain
Copy link

apurvajain commented Jul 14, 2020

This error occurs when you target service isn't running properly. Test your POST call to specified url with request body and response type is a lua table (JSON):

curl -X POST http://kong:8001/apis/{api}/plugins \
    --data "name=middleman" \
    --data "config.url=http://myserver.io/validate"
    --data "config.response=table"
    --data "config.timeout=10000"
    --data "config.keepalive=60000"

If still facing this issue go to json.lua line no. 984 function OBJDEF:decode(text, etc, options) add the below lines to avoid the error temporarily:

if text == nil then
   text = ''
end

@anassolanki
Copy link
Author

Hello, my target service is running fine @apurvajain. I am adding the condition you have given. Is there any problem if we get that 'nill' error?

@abdulrazakbg
Copy link

abdulrazakbg commented Dec 9, 2021

@anassolanki I am also getting the same error while calling api deployed on k8s but its working fine if I connected to local spring boot application API. have you got any solution for above issues ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants