Heroku mongodb deployment error React course

do not use the “mongodb+srv://”, use the “mongodb://” options.

Hey, Thanks for your answer.

It helped me solve Unauthorized error. However, after following the steps I got this error.

‘MongoError: seed list contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name’

Help would be appreciated.

My connection uri: mongodb://vidlyuser:@vidlydb-shard-00-00.wft4x.mongodb.net:27017,vidlydb-shard-00-01.wft4x.mongodb.net:27017,vidlydb-shard-00-02.wft4x.mongodb.net:27017/?ssl=true&replicaSet=atlas-13gtrm-shard-0&authSource=admin&retryWrites=true&w=majority

@sampreeth : I got the same error message. For me, using the Heroku CLI was removing characters after any ampersand claiming it is some command. Putting it in double quotes worked for small strings, but not large ones?!

ANYWAY, I used the Heroku dashboard (https://dashboard.heroku.com/apps/ --> “Settings” button --> “Reveal Config Vars” button) to put the mongodb (the 2.2.12 connect version) string in for the “vidly_db” key with the appropriate changes (like password and database name).

I hope this fixes it for you.

How about authSource should I change that from admin to dbname?

@Ari87 I tried changing as mention.
Now I’m getting.
MongoError: Authentication failed. at NessageStream.messageHandler

However, my dbname is correct, password is the user password.

I’m stuck with this issue from 2 days. If you can help it would be really great.
Thanks in advance.

Steps I followed to fix this issue.


npm update mongoose

Latest mongoose as of 5/01/2021 is mongoose 5.11.10. If there is a newer version please check the documentation.

If you are following mosh course. Open db.js in startup folder.




mongoose.connect(db, {useNewUrlParser:true, useUnifiedTopology: true})

copy the connection string for Node driver version 2.2.12 or later.

make sure the connection string does not have (mongodb+srv)

copied connection string for node driver version 2.2.12 will look like as shown below.


Replace “password” with the password for the “username” user. Replace “dbname” with the name of the database that connections will use by default.
Once replaced, remove all the angle brackets.

Head over to heroku dashboad,
→Settings → Click on “Reveal Config Vars” → Enter the Key as vidly_db, value will the connection mongodb connection string.

Back to terminal,
git add .
git commit -m “Commit message”
git push heroku master
heroku open

Hope this helps someone. It was a struggle for me to find this solution.


Ps: @programmingwithmosh Mlab is now bought by mongodb atlas. If you could update this in your course it would be really grateful.


thank you man!! the first time I put Heroku open it take me to the server with no errors, then I try again and send me again application error why is that? Also, do I need to connect with that url the mongoDB desktop app?

Thank you @sampreeth your solution helped

1 Like

Thanks @sampreeth your solution saved me from hours of heartache

1 Like

Hi sorry to disturb you but can you help solve this axios error
eperm: saying operation not permitted, read.
Please i will be very much grateful thanks.

great @sampreeth brother for this tips work to me.i was struggle past 3 days but this time resolve this error.again thanks in advance. :slightly_smiling_face:


Thank You!
it is helpfull!!

1 Like

Thank you! :slight_smile: you are great

1 Like

Hello Justly,
sorry for the late reply, I hope your error has been resolved.

Thanks, guys for this helpful discussion for many of us, I appreciate that! :+1:

How in the world do I solve this?

this is a different project not vidly

@sampreeth Thank you so much for your detailed solution.

1 Like

@sampreeth Thank you very much I’ve been stuck with connecting MongoDB Atlas and Heroku for half a day your answer saved me.

1 Like

I can’t even thank you enough, because that problem already took me 2 days until I found your solution.
again thank you for sharing the solution

1 Like

thanks a lot, it really hepled