Unable to pass one of the tests

Tell us what’s happening:
Describe your issue in detail here.
unable to pass the test that says database connection must be present
Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Mobile Safari/537.36.

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

Hello there,

Just to clarify something:

  • The sample.env file is not used by any system, and should only be used to help other devs understand what environment variables might be needed for an app.
  • The sample.env file is publicly visible on Replit. So, any secrets (DB passwords) kept in there can be easily taken, leaving your Database in jeopardy. It could end up costing you money, or, worse, lead you to be liable for illegal activity on your database account, if you do not remove visible access to your URI
  • .env files should be used for secrets. Or, if you have specifically set the configurations to, another plain text file name can be used.
  • On Replit, the SECRETS tab on the left nav is equivalent to a .env file, and you should use this for environment variables.

Otherwise, it is most likely the console/terminal will have helpful errors/warnings I suggest you spend some time getting used to, and searching for results.

EDIT: Looking at your server.js file:

passport.use(new LocalStrategy(
     myDataBase.findOne({username:username}, function(err, user){
       console.log('User ' + username + 'attempted to log in');
         return done(err);
         return done(null, false);
       if(password !== user.password){
         return done(null, false);
       return done(null, user);

How do you expect passport.use to have access to myDataBase when it is in a different scope?

Hope this clarifies

Unfortunately the new secret left tab is not yet available to all users.Replit says its is still neing rolled out to users and may take some time. Until then, I guess, I will put a hold on these assignments!

Ah. Well, sorry about that. Is there not any way to opt in to the update? It sounds bizarre that you would not be able to create any environment variables.

I just got this new feature available for my replit. for the mongodb password do i store the password as PW in the key and my password value in the value tab without any equal to sign?
And the SESSION_SECRET in the key tab and its value in the value tab? with or without quotes?
cannot see any examples on google for this new feature…

i found it. I passed the challenge. thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.