Cannot pass! :( — Advanced Node and Express - Registration of New Users

Cannot pass! :( — Advanced Node and Express - Registration of New Users

Dear kind ladies and gentlemen of the freeCodeCamp community,

I implore you: please, lend me your aid!

I’ve been trying to do this exercise for around a week. The aim is to register a new profile using Node, Passport etc.

Here’s the problem: I keep getting the same error, that “login should work”.

Logging in manually seems to work just fine! If I type “freeCodeCampTester” as the login and password (which is what the tester code uses to attempt to login), then it works — the app correctly renders the profile page with a big “Welcome freeCodeCampTester!”. But the test seems to fail every time.

Here’s what I’ve tried so far. As far as I know, I tried every suggestion that I could find by searching this issue on this forum, including:

  • adding delays to the “login”, “logout”, “register” functions
  • changing the mongoDB Cloud Atlas connection link to use an older version of Node.js (2.2+ instead of 3.0+),
  • copy-pasting the code from the provided solution (here — it gives me the same error: login doesn’t work!)
  • moving around the various “app.route” lines to come earlier or later than each other
  • changing the links by removing “.pug” from “/views/pug/route.pug” & “/views/pug//index.pug” to simply “/views/pug/route” & “/views/pug//index”
  • changing the “title” line in “index.pug” to “Home Profile” and in “profile.pug” to “Profile Page”

Here is the error message that I am getting on the freeCodeCamp website: “The profile should properly display the welcome to the user logged in”. Previously, I had gotten a few other errors, like “Login should work if previous test was done successfully and redirect successfully to the profile. Check your work and clear your DB”, but it seems that I’ve managed to finally fix those.

Here is my Glitch page: [edit: removed now for privacy because future exercises needed me to add some GitHub data]

Please help? Thank you very much!! :smiley:

1 Like

I recall some issues with the tests there, it probably isn’t your code. Maybe this thread can help Advanced Node and Express - Registration of New Users

Solved! :smiley:

For anyone reading this in the future, I solved the issue by adding “freeCodeCampTester” to the index.pug and the profile.pug files, at the end of the “h1” lines :slight_smile: This should change the title at the top to “Home Page freeCodeCampTester”, for example.

I tried doing those a few times before, but this final fix this time could solve it. If your code is still not working, try a few other fixes in the forums!


Also, another note: a lot of users have advised to clear the database for MongoDB (the error messages also advise this sometimes). I couldn’t find a way to do this for a while, so here’s the easiest one that I found:

If you’re using MongoDB Cloud Atlas, click on the title of your cluster (e.g. “Cluster 0”). There should be five tabs: “Overview”, “Real Time”, “Metrics”, “Collections” and “Command Line Tools”. If you click on the “Collections” tab, you should see the data in your database. In the test case, you should see a folder called “test” that contains an item called “users”. Hover over the “users” and you should see a trash can that lets you delete it.

This was the easiest way to clear the database that I could find, that worked every time :slight_smile: And it worked for all the FCC tests.

Good luck with this challenge!


Wow…this was the last thing I had to do after many “hacks”, one has to wonder if this is by design that this challenge was so difficult to solve, or it’s just bad tests. Here is my Glitch Code if anyone stumbles upon this thread.

I tried with your glitch link

You should register route and display on home. is not passing