'Database connection should be present' keeps failing

Tell us what’s happening:

I am confused to keep failing the first test: ’ Database connection should be present '.
This is my project: https://replit.com/@darrecoder/boilerplate-advancednode#server.js

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

Welcome there,

Going to your app yields:

Please note:

  • The sample.env file is not used/read by anything
    • It is an example file describing what environment variables your app needs to run
  • The sample.env file is public
    • We can see your Database URI - this is a major security risk as anyone can read/write to your DB.
    • Delete the file, and use the SECRETS tab in Replit to add your environment variables

Hope this helps

1 Like

When I delete the sample.env file then put the Database URI into an environment variable at the SECRETS tab, It still keeps failing the first test.

You will have to debug why your connection is failing:

  1. Did you place the URI in the correct variable name?
  2. Are you sure you have the correct URI?
  3. Can you see the value of the URI if you print it to the console?
  4. Did you install the correct version of mongodb?

Hope this helps

1 Like

I found it, the mongodb version is 3.6.1. So, I changed to the correct version is 4.2.0. I am sorry when I get wrong.

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