pavlenkodev opened a new issue, #10730: URL: https://github.com/apache/apisix/issues/10730
### Description I have a serverless-pre-function plugin(GLOBALY) configured that gets a parameter from the authorization token coming in the request and registers it as an apisix variable. Serverless-pre-function processes globally for each request that comes to apisix. Vars with the built-in parameter are configured on the route. Vars checks my registered serverless-pre-function parameter for compliance. If the parameter does not match, we get 404 route not found and this is normal in such a situation. If the parameter matches, the request is processed by the route Problem : When Apisix does not receive requests for 3+ minutes, the first request returns 404 route not found even if all the input parameters of the request are correct. As if Apicis falls asleep for a while, and then does not have time to check for vars If you make requests constantly for some time, everything works well and the problem does not manifest itself This is my serverless-pre-function global rule plugin ``` curl -X PUT \ http://localhost:9180/api-admin/apisix/admin/global_rules/1 \ -H 'Content-Type: application/json' \ -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' \ -d '{ "plugins": { "serverless-pre-function": { "_meta": { "priority": 30000 }, "functions": [ "return function() local core = require(\"apisix.core\").ctx.register_var(\"sub\",function(ctx) local core = require(\"apisix.core\") local jwt = require(\"resty.jwt\") local sub_not_found = \"not found\" local access_token = core.request.header(ctx, \"Authorization\") local result_value; if not access_token then result_value = sub_not_found return result_value end local jwt_obj = jwt:load_jwt(access_token) result_value = tostring(jwt_obj.payload.sub) return result_value end ) end" ], "phase": "rewrite" } } }' ``` This is my route ``` { "uri": "/*", "name": "test", "methods": [ "GET" ], "vars": [ [ "sub", "IN", [ "123435" ] ] ], "upstream_id": "my-upstream", "status": 1 } ``` What could be the problem? Maybe I need to disable sleep mode somewhere? I will be glad of your help ### Environment APISIX version 3.5: etcd version 3.4.15 APISIX Dashboard version 3.01 -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
