However, if I try to use the plugin with the environment variable, emqx will crash.
root@d68c6f167479:/# emqx/rel/emqx/bin/emqx foreground
ERROR: DB Backend is RLOG, but an incompatible OTP version has been detected. Falling back to using Mnesia DB backend.
WARNING: Default (insecure) Erlang cookie is in use.
WARNING: Configure node.cookie in /emqx/rel/emqx/etc/emqx.conf or override from environment variable EMQX_NODE__COOKIE
WARNING: NOTE: Use the same cookie for all nodes in the cluster.
EMQX_DASHBOARD__DEFAULT_PASSWORD [dashboard.default_password]: ******
EMQX_DASHBOARD__DEFAULT_USERNAME [dashboard.default_username]: ******
EMQX_PLUGINS__INSTALL_DIR [plugins.install_dir]: /plugins
EMQX_PLUGINS__STATES__1__ENABLE [plugins.states.1.enable]: true
EMQX_PLUGINS__STATES__1__NAME_VSN [plugins.states.1.name_vsn]: elixir_plugin_template-0.1.0
EMQX_LOG__FILE_HANDLERS__DEFAULT__ENABLE [log.file_handlers.default.enable]: false
EMQX_LOG__CONSOLE_HANDLER__ENABLE [log.console_handler.enable]: true
EMQX_NODE__DB_ROLE [node.db_role]: core
EMQX_NODE__DB_BACKEND [node.db_backend]: mnesia
Listener ssl:default on 0.0.0.0:8883 started.
Listener tcp:default on 0.0.0.0:1883 started.
Listener ws:default on 0.0.0.0:8083 started.
Listener wss:default on 0.0.0.0:8084 started.
2023-04-04T01:33:39.489208+00:00 [error] msg: failed_to_copy_plugin_from_other_nodes, mfa: emqx_plugins:ensure_exists_and_installed/1, line: 493, name_vsn: elixir_plugin_template-0.1.0, node_errors: []
2023-04-04T01:33:39.489419+00:00 [warning] msg: plugin_op_failed, mfa: emqx_plugins:tryit/2, line: 447, exception: {badmatch,{error,plugin_not_found}}, stacktrace: [{emqx_plugins,'-do_ensure_started/1-fun-0-',1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,424}]},{emqx_plugins,tryit,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,434}]},{emqx_plugins,for_plugin,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,805}]},{lists,flatmap_1,2,[{file,"lists.erl"},{line,1335}]},{emqx_plugins,for_plugins,1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,799}]},{emqx_plugins_app,start,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl"},{line,28}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}], which_op: start_plugins
2023-04-04T01:33:39.489758+00:00 [error] crasher: initial call: application_master:init/4, pid: <0.2681.0>, registered_name: [], exit: {{bad_return,{{emqx_plugins_app,start,[normal,[]]},{'EXIT',{#{errors => [{"elixir_plugin_template-0.1.0",{failed,"start_plugins"}}],function => fun emqx_plugins:do_ensure_started/1},[{emqx_plugins,for_plugins,1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,801}]},{emqx_plugins_app,start,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl"},{line,28}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}]}}}},[{application_master,init,4,[{file,"application_master.erl"},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}, ancestors: [<0.2680.0>], message_queue_len: 1, messages: [{'EXIT',<0.2682.0>,normal}], links: [<0.2680.0>,<0.2103.0>], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 169; neighbours:
2023-04-04T01:33:39.490179+00:00 [critical] msg: failed_to_start_app, mfa: emqx_machine_boot:start_one_app/1, line: 103, app: emqx_plugins, reason: {emqx_plugins,{bad_return,{{emqx_plugins_app,start,[normal,[]]},{'EXIT',{#{errors => [{"elixir_plugin_template-0.1.0",{failed,"start_plugins"}}],function => fun emqx_plugins:do_ensure_started/1},[{emqx_plugins,for_plugins,1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,801}]},{emqx_plugins_app,start,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl"},{line,28}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}]}}}}}
2023-04-04T01:33:39.490516+00:00 [error] Supervisor: {local,emqx_machine_sup}. Context: start_error. Reason: {'EXIT',{{failed_to_start_app,emqx_plugins,{emqx_plugins,{bad_return,{{emqx_plugins_app,start,[normal,[]]},{'EXIT',{#{errors => [{"elixir_plugin_template-0.1.0",{failed,"start_plugins"}}],function => fun emqx_plugins:do_ensure_started/1},[{emqx_plugins,for_plugins,1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,801}]},{emqx_plugins_app,start,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl"},{line,28}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}]}}}}}},[{emqx_machine_boot,start_one_app,1,[{file,"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl"},{line,104}]},{lists,foreach_1,2,[{file,"lists.erl"},{line,1442}]},{emqx_machine_boot,post_boot,0,[{file,"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl"},{line,39}]},{supervisor,do_start_child_i,3,[{file,"supervisor.erl"},{line,414}]},{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,400}]},{supervisor,'-start_children/2-fun-0-',3,[{file,"supervisor.erl"},{line,384}]},{supervisor,children_map,4,[{file,"supervisor.erl"},{line,1250}]},{supervisor,init_children,2,[{file,"supervisor.erl"},{line,350}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,851}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}}. Offender: id=emqx_machine_boot,pid=undefined.
2023-04-04T01:33:39.492051+00:00 [error] crasher: initial call: application_master:init/4, pid: <0.2250.0>, registered_name: [], exit: {{{shutdown,{failed_to_start_child,emqx_machine_boot,{'EXIT',{{failed_to_start_app,emqx_plugins,{emqx_plugins,{bad_return,{{emqx_plugins_app,start,[normal,[]]},{'EXIT',{#{errors => [{"elixir_plugin_template-0.1.0",{failed,"start_plugins"}}],function => fun emqx_plugins:do_ensure_started/1},[{emqx_plugins,for_plugins,1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,801}]},{emqx_plugins_app,start,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl"},{line,28}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}]}}}}}},[{emqx_machine_boot,start_one_app,1,[{file,"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl"},{line,104}]},{lists,foreach_1,2,[{file,"lists.erl"},{line,1442}]},{emqx_machine_boot,post_boot,0,[{file,"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl"},{line,39}]},{supervisor,do_start_child_i,3,[{file,"supervisor.erl"},{line,414}]},{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,400}]},{supervisor,'-start_children/2-fun-0-',3,[{file,"supervisor.erl"},{line,384}]},{supervisor,children_map,4,[{file,"supervisor.erl"},{line,1250}]},{supervisor,init_children,2,[{file,"supervisor.erl"},{line,350}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,851}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}}}},{emqx_machine_app,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}, ancestors: [<0.2249.0>], message_queue_len: 1, messages: [{'EXIT',<0.2251.0>,normal}], links: [<0.2249.0>,<0.2103.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 28, reductions: 242; neighbours:
Listener ssl:default on 0.0.0.0:8883 stopped.
Listener tcp:default on 0.0.0.0:1883 stopped.
Listener ws:default on 0.0.0.0:8083 stopped.
Listener wss:default on 0.0.0.0:8084 stopped.
{"Kernel pid terminated",application_controller,"{application_start_failure,emqx_machine,{{shutdown,{failed_to_start_child,emqx_machine_boot,{'EXIT',{{failed_to_start_app,emqx_plugins,{emqx_plugins,{bad_return,{{emqx_plugins_app,start,[normal,[]]},{'EXIT',{#{errors => [{\"elixir_plugin_template-0.1.0\",{failed,\"start_plugins\"}}],function => fun emqx_plugins:do_ensure_started/1},[{emqx_plugins,for_plugins,1,[{file,\"/emqx/apps/emqx_plugins/src/emqx_plugins.erl\"},{line,801}]},{emqx_plugins_app,start,2,[{file,\"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl\"},{line,28}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,293}]}]}}}}}},[{emqx_machine_boot,start_one_app,1,[{file,\"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl\"},{line,104}]},{lists,foreach_1,2,[{file,\"lists.erl\"},{line,1442}]},{emqx_machine_boot,post_boot,0,[{file,\"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl\"},{line,39}]},{supervisor,do_start_child_i,3,[{file,\"supervisor.erl\"},{line,414}]},{supervisor,do_start_child,2,[{file,\"supervisor.erl\"},{line,400}]},{supervisor,'-start_children/2-fun-0-',3,[{file,\"supervisor.erl\"},{line,384}]},{supervisor,children_map,4,[{file,\"supervisor.erl\"},{line,1250}]},{supervisor,init_children,2,[{file,\"supervisor.erl\"},{line,350}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,851}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}}},{emqx_machine_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,emqx_machine,{{shutdown,{failed_to_start_child,emqx_machine_boot,{'EXIT',{{failed_to_start_app,emqx_plugins,{emqx_plugins,{bad_return,{{emqx_plugins_app,start,[normal,[]]},{'EXIT',{#{errors => [{"elixir_plugin_template-0.1.0",{failed,"start_plugins"}}],function => fun emqx_plugins:do_ensure_started/1},[{emqx_plugins,for_plugins,1,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins.erl"},{line,801}]},{emqx_plugins_app,start,2,[{file,"/emqx/apps/emqx_plugins/src/emqx_plugins_app.erl"},{line,28}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}]}}}}}},[{emqx_machine_boot,start_one_app,1,[{file,"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl"},{line,104}]},{lists,foreach_1,2,[{file,"lists.erl"},{line,1442}]},{emqx_machine_boot,post_boot,0,[{file,"/emqx/apps/emqx_machine/src/emqx_machine_boot.erl"},{line,39}]},{supervisor,do_start_child_i,3,[{file,"supervisor.erl"},{line,414}]},{supervisor,do_start_child,2,
Crash dump is being written to: log/erl_crash.dump...done