Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MongoDB Auth not compatible with version 6 #2173

Open
1 task done
GabrielSchlatter opened this issue Jul 14, 2023 · 7 comments
Open
1 task done

[Bug]: MongoDB Auth not compatible with version 6 #2173

GabrielSchlatter opened this issue Jul 14, 2023 · 7 comments
Labels

Comments

@GabrielSchlatter
Copy link

Environment

  • VerneMQ Version: 1.13.0
  • OS: Docker Alpine Image
  • Erlang/OTP version (if building from source):
  • Cluster size/standalone:

Current Behavior

The VerneMQ starts up as usual, but as soon as i try to connect with a user (that has proper credentials in my mongodb), i see a crash log

Expected behaviour

When using MongoDB 4.x i had no issues at all, according to the logs it seems that a mongodb driver version needs to be updated

Configuration, logs, error output, etc.

[vernemq-0 vernemq] 09:30:41.880 [info] enable auth script for mongodb "./share/lua/auth/mongodb.lua"
[vernemq-0 vernemq] 09:32:03.223 [error] gen_server <0.664.0> terminated with reason: {bad_query,#{<<"$err">> => <<"OP_QUERY is no longer supported. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal">>,<<"code">> => 5739101,<<"ok">> => 0.0}} in mc_connection_man:process_error/2 line 123
[vernemq-0 vernemq] 09:32:03.223 [error] CRASH REPORT Process <0.664.0> with 0 neighbours crashed with reason: {bad_query,#{<<"$err">> => <<"OP_QUERY is no longer supported. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal">>,<<"code">> => 5739101,<<"ok">> => 0.0}} in mc_connection_man:process_error/2 line 123
[vernemq-0 vernemq] 09:32:03.223 [error] can't execute find_one [{<<"client_id">>,<<"test-client">>},{<<"mountpoint">>,<<>>},{<<"username">>,<<"gabriel">>}] due to exit:{{{bad_query,#{<<"$err">> => <<"OP_QUERY is no longer supported. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal">>,<<"code">> => 5739101,<<"ok">> => 0.0}},[{mc_connection_man,process_error,2,[{file,"/opt/vernemq/_build/default/lib/mongodb/src/connection/mc_connection_man.erl"},{line,123}]},{mc_connection_man,read_one,2,[{file,"/opt/vernemq/_build/default/lib/mongodb/src/connection/mc_connection_man.erl"},{line,37}]},{vmq_diversity_worker_wrapper,handle_call,3,[{file,"/opt/vernemq/apps/vmq_diversity/src/vmq_diversity_worker_wrapper.erl"},{line,136}]},{gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,1149}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,1178}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]},{gen_server,call,[<0.664.0>,{apply,mc_worker_api,find_one,[<<"vmq_acl_auth">>,#{<<"client_id">> => <<"test-client">>,<<"mountpoint">> => <<>>,<<"username">> => <<"gabriel">>},#{readopts => #{<<"mode">> => <<"primaryPreferred">>}}]},infinity]}}
[vernemq-0 vernemq] 09:32:03.223 [error] can't call function auth_on_register with args [{addr,<<"10.240.0.9">>},{port,16697},{mountpoint,<<>>},{client_id,<<"test-client">>},{username,<<"gabriel">>},{password,<<"gabrpal">>},{clean_session,true}] in "./share/lua/auth/mongodb.lua" due to {badarg,execute_find_one,[<<"auth_mongodb">>,<<"vmq_acl_auth">>,{tref,31}]}
[vernemq-0 vernemq] 09:32:03.223 [warning] can't authenticate client {[],<<"test-client">>} from 10.240.0.9:16697 due to lua_script_error
[vernemq-0 vernemq] 09:32:03.226 [error] Supervisor {<0.659.0>,poolboy_sup} had child vmq_diversity_worker_wrapper started with {vmq_diversity_worker_wrapper,start_link,undefined} at <0.664.0> exit with reason {bad_query,#{<<"$err">> => <<"OP_QUERY is no longer supported. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal">>,<<"code">> => 5739101,<<"ok">> => 0.0}} in mc_connection_man:process_error/2 line 123 in context child_terminated

Code of Conduct

  • I agree to follow the VerneMQ's Code of Conduct
@ioolkos
Copy link
Contributor

ioolkos commented Jul 14, 2023

@GabrielSchlatter
Thanks.
There's some info by @codeadict here:

#2027
comtihon/mongodb-erlang#254

In short, MongoDB removed some Opcodes in 6.x, so we don't have MongoDB 6.x support in VerneMQ, since the driver lib does not support it. At least that's my current understanding of the matter.


👉 Thank you for supporting VerneMQ: https://github.com/sponsors/vernemq
👉 Using the binary VerneMQ packages commercially (.deb/.rpm/Docker) requires a paid subscription.

@mths1
Copy link
Contributor

mths1 commented Jul 29, 2023

Why not switch to the fork? It seems to "compile".

@ioolkos
Copy link
Contributor

ioolkos commented Aug 1, 2023

@mths1 I haven't looked at the fork in detail but it misses quite some commits, so might be diverged a bit.
If there's no movement on the original repo, I guess it means we should do our own fork to merge the work from the EMQ fork.
cc @codeadict


👉 Thank you for supporting VerneMQ: https://github.com/sponsors/vernemq
👉 Using the binary VerneMQ packages commercially (.deb/.rpm/Docker) requires a paid subscription.

@codeadict
Copy link
Contributor

that or ask the maintainer for ownership

@codeadict
Copy link
Contributor

@ioolkos I have cloned the repo and working on a PR

@GabrielSchlatter
Copy link
Author

We received notifications from MongoDB Atlas recently: "MongoDB 5.0 End of Life on October 31, 2024; automatic Atlas cluster upgrades to 6.0". Is there any chance the driver will be updated and made compatible before that date?

Or would you suggest switching to another auth method in advance to avoid service disruptions?

@ioolkos
Copy link
Contributor

ioolkos commented Mar 18, 2024

My intention certainly is to continue supporting MongoDB as an auth database.
In that sense, there "is a chance", yes. Let me add that in general and for the question at hand, we're thankful for support as well (PR's, sponsoring, etc).


👉 Thank you for supporting VerneMQ: https://github.com/sponsors/vernemq
👉 Using the binary VerneMQ packages commercially (.deb/.rpm/Docker) requires a paid subscription.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants