MongoDB Exception authenticating MongoCredential
FierraCodes opened this issue ยท 11 comments
Description
Luckperms having issues to authenciate with MongoDB, Throwing Exception authenticating MongoCredential
and Authentication failed.' on server ac-4ambohl-shard-00-01.2xhehw2.mongodb.net:27017. The full response is {"ok": 0, "errmsg": "bad auth : Authentication failed.", "code": 8000, "codeName": "AtlasError"}
Reproduction Steps
- Set Up MongoDB On Luckperms
- Start Server
- Error
Expected Behaviour
Authenticate Normally & Successfully
Server Details
Velocity-3.2.0 & Paper git-Paper-538
LuckPerms Version
v5.4.79
Logs and Configs
All Logs & Configs:
https://gist.github.com/FierraCodes/4ef61f84f6f2abe1da24656c7802b279
Extra Details
I made a new user on MongoDB specially for LuckPerms, used to work but doesn't work now. Permissions are read & write to all DBs
Unfortunately I cannot reproduce the error. Have you ever considered that it's not because of LuckPerms but because of the database?
It worked previously without any error, but after reinstalling luckperms it just doesnt work.
It's hard to tell which source authenticates your user if your host doesn't let you know. I would just ask if I were you.
Does the connection to the database work via Studio3T or MongoDB Compass on your computer? (With the connection string you specify in LuckPerms)
I have no idea, cause it was sort of a long time ago and i didn't back it up (server data, not databse)
The last real change to the MongoDB storage implementation that I can understand here is from early 2022. If you were previously using a reasonably up-to-date version of LuckPerms, then it seems to me at first that there is a problem with the database.
As I can see, you didn't specify an authentication database in your connection string either. Depending on how MongoDB is configured, you might need this.
May I ask how to do that? Because I don't see an option for that (im using a free cluster)
Yep, after remaking the users. But luckperms side still doesnt work
Error:
[11:54:22 ERROR]: [LuckPerms] Exception occurred whilst loading data for 383e19d0-5b39-425d-9824-65446ef0a95f - FierraPlayz
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "me.lucko.luckperms.lib.mongodb.client.MongoDatabase.getCollection(String)" because "this.database" is null
at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source) ~[?:?]
at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source) ~[?:?]
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[?:?]
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source) ~[?:?]
at java.util.concurrent.ForkJoinPool.scan(Unknown Source) ~[?:?]
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[?:?]
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "me.lucko.luckperms.lib.mongodb.client.MongoDatabase.getCollection(String)" because "this.database" is null
at me.lucko.luckperms.common.storage.implementation.mongodb.MongoStorage.savePlayerData(MongoStorage.java:548) ~[?:?]
at me.lucko.luckperms.common.storage.Storage.lambda$savePlayerData$21(Storage.java:269) ~[?:?]
at me.lucko.luckperms.common.storage.Storage.lambda$future$0(Storage.java:88) ~[?:?]
... 7 more
I just set up a brand new server with only LuckPerms on it. In addition, I created a new MongoDB database server and with this configuration I have no problems in version 5.4.82.
https://gist.github.com/Dominik48N/fbb0476495d5997bb34e2c12ec2b0779 (I removed the username and password from the connection string for publication.)
As I said, I can't reproduce the error. It really seems to me that the problem is with your database server right now. Maybe try to set up the MongoDB database on another server or look for another managed solution to try it out. I tried it with fresh MongoDB and LuckPerms on 1.19.4 and I have no problems.