MongoDb sasl conversation error: unable to authenticate using mechanism #171
Unanswered
malconvsilva
asked this question in
Q&A
Replies: 2 comments
-
Feel free to submit a PR that fixes this for you. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Linked to: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
db-dumper 3.2.0
laravel 8.83 / php 8.0
mongodb 5.0.1
os: windows 11
Hello,
I'm facing a problem trying to dump mongodb in my environment.
Code I'm running:
\Spatie\DbDumper\Databases\MongoDb::create() ->setHost(config('database.connections.mongodb.host')) ->setPort(config('database.connections.mongodb.port')) ->setDbName(config('database.connections.mongodb.database')) ->setUserName(config('database.connections.mongodb.username')) ->setPassword(config('database.connections.mongodb.password')) ->setAuthenticationDatabase(config('database.connections.mongodb.dump.mongodb_user_auth')) ->dumpToFile("c:\\Temp\\123\\test.dump");
Result:
The dump process failed with a none successful exitcode. Exitcode ======== 1: General error Output ====== <no output> Error Output ============ 2022-06-14T11:54:00.381-0300 Failed: can't create session: could not connect to server: connection() error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.
After some testing, I found that the command being executed was:
"mongodump" --db wfm --archive --username 'user' --password 'pass***' --host 127.0.0.1 --port 27017 --authenticationDatabase admin > "c:\\Temp\\123\\test.dump"
When running it directly in PowerShell, it ran successfully.
I ran more tests by directly changing the file \Spatie\DbDumper\Databases\MongoDb.php .When I removed the single quotes from the username and password the code ran successfully. (lines 69 and 73 of \Spatie\DbDumper\Databases\MongoDb.php );
Note: changing to double quotes also works
`
public function getDumpCommand(string $filename): string
{
$quote = $this->determineQuote();
Command generated after change:
"mongodump" --db wfm --archive --username user --password pass*** --host 127.0.0.1 --port 27017 --authenticationDatabase admin > "c:\Temp\123\test.dump"
`
I can't say if it's a problem unique to the windows environment, but the same problem occurs on windows server 2016.
Beta Was this translation helpful? Give feedback.
All reactions