用环境变量配置authentication为mysql,报mechanism_field_required

错误报告

[error] crasher: initial call: application_master:init/4, pid: <0.2571.0>, registered_name: [], exit: {{{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_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,226}]}]}, ancestors: [<0.2570.0>], message_queue_len: 1, messages: [{‘EXIT’,<0.2572.0>,normal}], links: [<0.2570.0>,<0.1688.0>], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 29, reductions: 167; neighbours:

环境

  • EMQX 版本:5.0.10
  • 操作系统版本:docker

重现此问题的步骤

  1. docker-> emqx/emqx:5.0.10
  2. 环境变量:EMQX_AUTHENTICATION__1
  3. 环境变量值:{mechanism=“password_based”,backend=“mysql”,server=“xxx:3306”,database=“emqx”,username=“emqx”,password=“emqx”,query=“SELECT password_hash, salt, is_superuser FROM mqtt_user WHERE username = ${username} LIMIT 1”,password_hash_algorithm={name=sha256,salt_position=prefix},enable=true}

预期行为

不应该启动失败

实际行为

启动失败,报缺少mechanism字段


功能请求

描述你需要的功能

为什么你需要这个功能


其他

这个是详细错误日志

2022-11-25T06:34:01.241839+00:00 [error] crasher: initial call: application_master:init/4, pid: <0.2571.0>, registered_name: [], exit: {{{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_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,226}]}]}, ancestors: [<0.2570.0>], message_queue_len: 1, messages: [{‘EXIT’,<0.2572.0>,normal}], links: [<0.2570.0>,<0.1688.0>], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 29, reductions: 167; neighbours:
2022-11-25T06:34:01.242084+00:00 [notice] Application: emqx_authn. Exited: {{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_app,start,[normal,[]]}}. Type: temporary.
2022-11-25T06:34:01.243861+00:00 [notice] Application: jose. Exited: stopped. Type: temporary.
2022-11-25T06:34:01.243916+00:00 [critical] app: emqx_authn, line: 88, mfa: emqx_machine_boot:start_one_app/1, msg: failed_to_start_app, reason: {emqx_authn,{{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_app,start,[normal,[]]}}}
2022-11-25T06:34:01.244006+00:00 [error] Supervisor: {local,emqx_machine_sup}. Context: start_error. Reason: {‘EXIT’,{{failed_to_start_app,emqx_authn,{emqx_authn,{{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_app,start,[normal,[]]}}}},[{emqx_machine_boot,start_one_app,1,[{file,“emqx_machine_boot.erl”},{line,89}]},{lists,foreach,2,[{file,“lists.erl”},{line,1342}]},{emqx_machine_boot,post_boot,0,[{file,“emqx_machine_boot.erl”},{line,38}]},{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,423}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}}. Offender: id=emqx_machine_boot,pid=undefined.
2022-11-25T06:34:01.244388+00:00 [error] crasher: initial call: application_master:init/4, pid: <0.1924.0>, registered_name: [], exit: {{{shutdown,{failed_to_start_child,emqx_machine_boot,{‘EXIT’,{{failed_to_start_app,emqx_authn,{emqx_authn,{{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_app,start,[normal,[]]}}}},[{emqx_machine_boot,start_one_app,1,[{file,“emqx_machine_boot.erl”},{line,89}]},{lists,foreach,2,[{file,“lists.erl”},{line,1342}]},{emqx_machine_boot,post_boot,0,[{file,“emqx_machine_boot.erl”},{line,38}]},{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,423}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}}}},{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,226}]}]}, ancestors: [<0.1923.0>], message_queue_len: 1, messages: [{‘EXIT’,<0.1925.0>,normal}], links: [<0.1923.0>,<0.1688.0>], dictionary: [], trap_exit: true, status: running, heap_size: 1598, stack_size: 29, reductions: 243; neighbours:
2022-11-25T06:34:01.244684+00:00 [notice] Application: emqx_machine. Exited: {{shutdown,{failed_to_start_child,emqx_machine_boot,{‘EXIT’,{{failed_to_start_app,emqx_authn,{emqx_authn,{{failed_to_initialize_authentication,{invalid_config,“mechanism_field_required”}},{emqx_authn_app,start,[normal,[]]}}}},[{emqx_machine_boot,start_one_app,1,[{file,“emqx_machine_boot.erl”},{line,89}]},{lists,foreach,2,[{file,“lists.erl”},{line,1342}]},{emqx_machine_boot,post_boot,0,[{file,“emqx_machine_boot.erl”},{line,38}]},{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,423}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}}}},{emqx_machine_app,start,[normal,[]]}}. Type: permanent.

可以看下你环境变量是怎么设置的吗?