zheng11581 opened a new issue #1682: URL: https://github.com/apache/incubator-apisix/issues/1682
### Issue description Use `filter_fun` problem. 1. My config is curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uris": ["/api/*"], "methods": ["GET", "POST"], "filter_func": "function(vars) return vars['arg_a1'] == 'a1' and vars['arg_a2'] == 'a2' end", "upstream": { "type": "roundrobin", "nodes": { "127.0.0.1:20608": 1 } } }' 2. curl -i "http://127.0.0.1:9080/api/index?a1=a1&a2=a2" HTTP/1.1 500 Internal Server Error Date: Wed, 10 Jun 2020 05:55:12 GMT Content-Type: text/html Content-Length: 174 Connection: close Server: APISIX web server <html> <head><title>500 Internal Server Error</title></head> <body> <center><h1>500 Internal Server Error</h1></center> <hr><center>openresty</center> </body> </html> 3. error.log 2020/06/10 13:55:12 [error] 20344#20344: *34173910 lua entry thread aborted: runtime error: [string "router#1"]:2: invalid argument, expect string value stack traceback: coroutine 0: [C]: in function 'error' /usr/local/apisix/apisix/core/ctx.lua:68: in function '__index' [string "router#1"]:2: in function 'filter_fun' /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:531: in function 'match_route_opts' /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:550: in function '_match_from_routes' /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:582: in function 'match_route' /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:614: in function 'dispatch' /usr/local/apisix/apisix/http/router/radixtree_uri.lua:110: in function 'match' /usr/local/apisix/apisix/init.lua:285: in function 'http_access_phase' access_by_lua(nginx.conf:168):2: in main chunk, client: 127.0.0.1, server: , request: "GET /api/index?a1=a1&a2=a2 HTTP/1.1", host: "127.0.0.1:9080" ### Environment * apisix version (cmd: `apisix version`): 1.3 * OS: centos 7 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
