Error: option gssapiservicename is not supported

Viewed 2381

mongoose(6.0.12) throw error Error: option gssapiservicename is not supported.

Here the code for setting up the mongodb connection :

const connectDB = async () => {
try {
    const conn = await mongoose.connect(process.env.MONGO_URI, {
        useUnifiedTopology: true,
        useNewUrlParser: true,
    })

    console.log(`MongoDB Connected: ${conn.connection.host}`.cyan.underline)
} catch (error) {
    console.error(`Error: ${error.message}`.red.underline.bold)
    process.exit(1)
}

}

2 Answers

Just remove the parameter in your connection string, newer versions of Clients doesn’t support this anymore

The issue is with your Mongo URI, it should not have any parameter, eg: mongodb://localhost:27017

Related