apache / apisix-dashboard

Dashboard for Apache APISIX
https://apisix.apache.org/
Apache License 2.0
1.01k stars 532 forks source link

bug: dashboard should not support '!' in vars. #2687

Open 840963657 opened 1 year ago

840963657 commented 1 year ago

Issue description

apisix not support '!' operator . apisix error log: 2022/12/08 10:57:25 [error] 6804#6804: *2355864 [lua] config_etcd.lua:573: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: invalid operator '!', etcd key: /apisix/routes, context: ngx.timer

Expected behavior

When create route, dashboard should not support '!' in vars.

How to Reproduce

  1. create route in dashboard
  2. add vars in route,operator use '!'
  3. view apisix's error.log file

Screenshots

![Uploading image.png…]() ![Uploading image.png…]()

Environment

Additional context

lua-resty-expr https://github.com/api7/lua-resty-expr/blob/main/lib/resty/expr/v1.lua lua-resty-expr don't support this operator '!'

SkyeYoung commented 1 year ago

Could u pls provide more accurate information?

840963657 commented 1 year ago

1、create route, add vars in route,operator use '!',like this: { "uri": "/", "name": "test", "methods": [ "GET" ], "vars": [ [ "http_test1", "!", "123" ] ], ....... 2、view apisix's error.log file: 2022/12/08 10:57:25 [error] 6804#6804: 2355864 [lua] config_etcd.lua:573: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: invalid operator '!', etcd key: /apisix/routes, context: ngx.timer

Baoyuantop commented 1 year ago

Hi @840963657, can you help with the specific steps to create this route using the dashboard? Also, you can try the latest version of the dashboard.

Baoyuantop commented 1 year ago

1、create route, add vars in route,operator use '!',like this: { "uri": "/", "name": "test", "methods": [ "GET" ], "vars": [ [ "http_test1", "!", "123" ] ], ....... 2、view apisix's error.log file: 2022/12/08 10:57:25 [error] 6804#6804: 2355864 [lua] config_etcd.lua:573: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: invalid operator '!', etcd key: /apisix/routes, context: ngx.timer

Unable to create this configuration via the UI, are you using the raw data editor?