Advanced Node and Express - Implement the Serialization of a Passport User

I keep failing the first test; “connection to database should be present”.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Advanced Node and Express - Implement the Serialization of a Passport User

Link to the challenge:

If I fork your code and add the required environment variables with my own DB I pass the tests.

Are you getting any errors in the console?

Make sure you add the connection string to the secrets and that you didn’t add quotes around the values. You can edit the JSON directly (Edit as JSON button) to check if they have double quotes ""somevalue"". If they do remove one of the sets of quotes.

Make sure the connection string contains the correct name/password and that you have whitelisted all IPs on MongoDB Atlas. Refer to the article linked on the challenge page.

This is the error in the console:

“Error: querySrv ENOTFOUND
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:47:19) {
errno: undefined,
code: ‘ENOTFOUND’,
syscall: ‘querySrv’,
hostname: ‘’

Well, it isn’t your code because as I said it passes for me with my own DB.

So I assume there is something wrong with your connection string or you didn’t otherwise follow the correct steps. Read the MongoDB article and make sure you have done everything correctly.

I’d follow all the steps but still not working… what is the correct db_name?

I don’t know what you mean.

Literally, all I did to make your code pass was to fill in the connection string in the environment variable. Post your connection string but replace the password so I can see it.

Considering you have already passed other challenges that require you to connect to a DB I’m not sure why this is now an issue.

You mean this?

I don’t know why it isn’t working for you.

On the Secrets tab click the {} Edit as JSON button and post the content. Again remove the password.

Also, make sure you do not have any special characters in the password or they must be encoded.

“PORT”: “8080”,
“NODE_ENV”: “development”,
“SESSION_SECRET”: “123456”,
“MONGO_URI”: “mongodb+srv://”

I have no idea why it isn’t working for you. Is it the same cluster, database, and connection string you have used for the other challenges? If not try using one of your old connections string from the other challenges you have already used and know that worked.

You can also try starting over and following the docs.