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

bug: proxy-cache plugin generate_complex_value may fail due to concat nil values #7167

Closed
worldwonderer opened this issue May 30, 2022 · 1 comment · Fixed by #7168
Closed

Comments

@worldwonderer
Copy link
Contributor

Current Behavior

if proxy-cache plugins configures cache_key with ["$arg_a", "$arg_b"] and $arg_a and $arg_b are both nil, apisix will abort with error.

I think it is quite normal that api has not required args, can this line tmp[i] = ctx.var[string.sub(value, 2)] change to tmp[i] = ctx.var[string.sub(value, 2)] or ""? if it is acceptable, i would like to submit a PR.

Expected Behavior

cache_key not fail with nil variables

Error Logs

[error] 3329653#3329653: *15666726 lua entry thread aborted: runtime error: ...tion/bin/apisix/plugins/proxy-cache.lua:149: invalid value (nil) at index 2 in table for 'concat'

Steps to Reproduce

create route with proxy-cache plugin, and configure cache key with "cache_key": ["$arg_a", "$arg_b"] and then request without url args

Environment

  • APISIX version (run apisix version):2.11.0
  • Operating system (run uname -a):Linux 11-186-252-137 4.14.105-1-tlinux3-0016 change: added doc of how to load plugin. #1 SMP Fri Jul 31 16:16:47 CST 2020 x86_64 x86_64 x86_64 GNU/Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V):nginx version: openresty/1.19.9.1
@worldwonderer worldwonderer changed the title bug: iproxy-cache plugin generate_complex_value may fail due to concat nil values bug: proxy-cache plugin generate_complex_value may fail due to concat nil values May 30, 2022
@soulbird
Copy link
Contributor

Welcome to contribute PR!

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

Successfully merging a pull request may close this issue.

2 participants