loseself opened a new issue #6702: URL: https://github.com/apache/apisix/issues/6702
### Description Referenced document: https://apisix.apache.org/zh/docs/apisix/plugin-develop/#%E6%B3%A8%E5%86%8C%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8F%98%E9%87%8F  How do I use it?, "register custom variable" Can you provide demo? how to register how to get how to destroy how to modify and announcements ---------------- After I registered, and reload plugin, there is an error local core = require "apisix.core" core.ctx.register_var("a6_labels_zone2", function(ctx) local route = ctx.matched_route and ctx.matched_route.value if route and route.labels then return route.labels.zone end return nil end) 22826 [lua] events.lua:194: do_handlerlist(): worker-events: event callback failed; source=/apisix/admin/plugins/reload, event=PUT, pid=47 error='/usr/local/apisix/apisix/plugin.lua:113: attempt to index local 'plugin' (a number value) stack traceback: /usr/local/apisix/apisix/plugin.lua:113: in function 'load_plugin' /usr/local/apisix/apisix/plugin.lua:191: in function 'load' /usr/local/apisix/apisix/plugin.lua:300: in function 'load' /usr/local/apisix/apisix/admin/init.lua:309: in function </usr/local/apisix/apisix/admin/init.lua:307> [C]: in function 'xpcall' ...local/apisix//deps/share/lua/5.1/resty/worker/events.lua:185: in function 'do_handlerlist' ...local/apisix//deps/share/lua/5.1/resty/worker/events.lua:219: in function 'do_event_json' ...local/apisix//deps/share/lua/5.1/resty/worker/events.lua:361: in function 'poll' ...local/apisix//deps/share/lua/5.1/resty/worker/events.lua:380: in function <...local/apisix//deps/share/lua/5.1/resty/worker/events.lua:375>', data=1648092700, context: ngx.timer ### Environment - APISIX version (run `apisix version`): 2.12.1 - Operating system (run `uname -a`): Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64 - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): nginx version: openresty/1.19.9.1 - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): version: 3.4.15, API version: 3.4 - APISIX Dashboard version, if relevant: - Plugin runner version, for issues related to plugin runners: - LuaRocks version, for installation issues (run `luarocks --version`): 3.8.0 -- 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]
