fix: mongodb authz crash
This fixes a crash with an error in the log file (see below) that happened when the MongoDB authorization module queried the database. The reason is that the collection name that was sent to the mongodb connection was an atom. This is fixed by making sure it is not an atom. 2023-03-08T17:16:34.215523+01:00 [error] msg: query_mongo_error, mfa: emqx_authz_mongodb:authorize/4, line: 95, peername: 127.0.0.1:53212, clientid: client123, collection: mqtt_acl, filter: #{username => <<"emqx_u">>}, reason: {resource_error,#{msg => #{error => {error,{error_cannot_parse_response,{op_msg_response,#{<<"code">> => 73,<<"codeName">> => <<"InvalidNamespace">>,<<"errmsg">> => <<"Failed to parse namespace element">>,<<"ok">> => 0.0}}}},id => <<"emqx_authz_mongodb:3">>,name => call_query,request => {find,mqtt_acl,#{username => <<"emqx_u">>},#{}},stacktrace => [{mc_connection_man,reply,1,[{file,"mc_connection_man.erl"},{line,123}], ...]}, reason => exception}}, resource_id: <<"emqx_authz_mongodb:3">> Fixes: https://github.com/emqx/emqx/issues/9783
This commit is contained in:
parent
4ee42bfd1f
commit
aa57ea9ee1
|
@ -240,7 +240,7 @@ http_common_fields() ->
|
|||
mongo_common_fields() ->
|
||||
[
|
||||
{collection,
|
||||
?HOCON(atom(), #{
|
||||
?HOCON(binary(), #{
|
||||
required => true,
|
||||
desc => ?DESC(collection)
|
||||
})},
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
A crash with an error in the log file that happened when the MongoDB authorization module queried the database has been fixed.
|
|
@ -0,0 +1 @@
|
|||
当MongoDB授权模块查询数据库时,在日志文件中发生的崩溃与错误已经被修复。
|
Loading…
Reference in New Issue