I'm writing a NodeJS/express API and am facing the following warning when connecting to mongo server:
Warning: no saslprep library specified. Passwords will not be sanitized
Found no mention of this warning in documentation or github/google - is that OS (linux) library missing, or node package?
This is the connection code sample:
const client = await MongoClient.connect(`mongodb://${auth[0]}:${auth[1]}@${url}/admin`, {
useNewUrlParser: true
});
this.db = client.db(database);
How can I get rid of it?
Additional information:
Mongodb server: docker mongo:latest, resolved to 4.0.4 as of now
mongodb library: 3.1.9
Just install the saslprep
package and the warning will go away.
The mongodb
package looks for the saslprep
package, but works without it; it's an optional dependency.
If you look in the mongodb source:
let saslprep;
try {
saslprep = require('saslprep');
} catch (e) {
And, later:
if (!saslprep) {
console.warn('Warning: no saslprep library specified. Passwords will not be sanitized');
}
Please use this command in your app. It worked for me. Hope it help you.
npm install saslprep --save
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With