Error: Unescaped @ Sign, even though it's escaped

I’m trying to do this lesson: Advanced Node and Express - Implement the Serialization of a Passport User

When I try to connect to my db, I get the error: Database error: Error: Username containing an unescaped at-sign

But my username should be escaping the at-sign. I use %40 where the @ sign normally would be, and yet I still get the error. I have not had this problem with prior projects, just this one.

My only guess is that things work differently since this project uses the MongoClient to connect whereas past projects I’ve done use Mongoose. But this is just my guess and I don’t know how to fix this issue. Could someone help.

Hi learis,

I googled your problem and the first cause I could find is a password containing the @ symbol. Does your password have @ in it?

Yes. I use “%40” in place of the @ symbol as the solutions for this problem describe. But it is still giving the error.

Ok this problem is now solved. The boilerplate starter code’s package.json file had an old version of mongodb “^2.2.22” for its dependency. When I put in glitch’s recommended newer version “^3.3.2”, it fixed itself and successfully connected.