Authentication with MongoDB failed after the Metabase upgrade


We have recently upgraded Metabase to 0.42.0 and since this upgrade we have the following error when we want to access data stored in MongoDB databases:

Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server so01wy.sii24.pole-emploi.intra:27017. The full response is { "operationTime" : { "$timestamp" : { "t" : 1667491241, "i" : 1 } }, "ok" : 0.0, "errmsg" : "Authentication failed. ", "code" : 18, "codeName" : "AuthenticationFailed", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1667491241, "i" : 1 } }, "signature" : { "hash" : { "$binary" : "IiNv2JircjP0mQ8EEAOMlspkvaQ=", "$type" : "00" }, "keyId" : { "$numberLong" : "7102166450470649862" } } }

No DB configuration changes were made between the 2 upgrades, we can access the data in command line with the user registered. And we are using MongoDB 4.4.9 in enterprise version which is normally supported with this version of Metabase.

The problem also persists with the latest versions of Metabase.

For information:

"browser-info": {
"language": "fr-FR",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36",
"vendor": "Google Inc."
"system-info": {
"file.encoding": "UTF-8",
"": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.14+9",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "",
"java.version": "11.0.14",
"": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.14+9",
"": "Linux",
"os.version": "4.15.0-191-generic",
"user.language": "en",
"user.timezone": "UTC"
"metabase-info": {
"databases": [
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MySQL",
"version": "5.7.29"
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.6.2"
"run-mode": "prod",
"version": {
"date": "2022-02-08",
"tag": "v0.42.0",
"branch": "release-x.42.x",
"hash": "de1264e"
"settings": {
"report-timezone": "Europe/Berlin"

Thank you in advance for your help

Hi @BaptisteB
Upgrade to latest release, and then make sure that you are authenticating against the correct "Authentication database" (aka authSource) in Admin > Databases > (db).
For many, it's just admin, but it's difficult to say, since it depends wildly on your Mongo setup.

1 Like

Hi @flamber ,

Thank you for your help. It was indeed a problem with the Authentication Database not being set to admin.

The question I have now is why was it working in 0.41.0 when nothing had been changed? Is it possible that a parameter was removed during the upgrade?


@BaptisteB It's caused by the input was incorrectly ignored in previous versions, but was fixed in 42.0, but that would then cause problems for some if they had input something wrong.

OK, I don't see it in the release notes. Maybe it should be added if other people find themselves in the same situation ?

@BaptisteB It's difficult for anyone to read a list of 206 changes:

Anyways, it's this one:

Upgrade to 0.44.6: