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
key-auth plugin returns error when key is set with empty value #4405
Comments
This issue may or may not be related to the issue I am facing (https://discuss.konghq.com/t/key-authentication-is-not-working/3034) I am passing the correct Kong: Docker 1.0.3-alpine |
This seems to be the block throwing the exception: https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua#L158-L161 I'm experiencing an HTTP status code of Does the block above get caught here?: https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua#L203 I'll take a look if I can free up some time - just sharing thoughts in case they help! |
Untested, but I think adjusting https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua#L158-L161 to the following will fix the issue: if err then
kong.log.err(err)
return nil, { status = 500, message = "An unexpected error occurred" }
end |
My issue is caused by Konga - pantsel/konga#369 |
@shugydw, I have been the same issue, any ideas for your problem? Thanks! |
Summary
The
key-auth
plugin returns an error (shown below) when theapikey
header is set with an empty value. While the fix could be to ensure the client does not pass an emptyapikey
, I feel the expected result should be either:anonymous
consumer (if defined); orapikey
was never setSteps To Reproduce
key-auth
plugin globally, or on a specific service/routeapikey
headerAdditional Details & Logs
Kong version: 1.0.3
Error thrown in the logs:
[kong] handler.lua:159 [key-auth] failed to get from node cache: [postgres] length must be at least 1
The text was updated successfully, but these errors were encountered: