MongoDB & Mongoose challenge tests failing despite correct setup

Hello everyone,

I’m currently stuck on the “Install and Set Up Mongoose” challenge. The tests keep failing even though my project seems configured correctly and MongoDB is connected.

What FCC reports (both fail):

1) “mongoose” version ^5.11.15 dependency should be in package.json

2) “mongoose” should be connected to a database

My setup:

  • Hosting the projects on Railway (also tested with Render and Replit).
  • package.json includes: “mongoose”: ^5.11.15”, along with “express” and “dotenv”.
  • App starts with node server.js.
  • In myApp.js, I connected with:

mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true
});

  • MONGO_URI is set in the host environment. Password is URL-safe, database name (fccdb) is added after .net/ and before the ?
  • Logs from the host show: “MongoDB connected”

Verification (live evidence):

  • When I open my deployed endpoint for /api/package.json, it clearly shows “mongoose”: “^5.11.15”
  • When I open my deployed endpoint for /api/is-mongoose-ok, it returns {“isok”: true, “readyState”: 1}

What I’ve already tried:

  • Rotated Atlas password, re-encoded it, and updated MONGO_URI.
  • Tried multiple hosts (Render, Replit, Railway).
  • Confirmed that Atlas cluster is accessible and whitelist allows all IPs.
  • Confirmed helper routes are working (I can see both package.json contents and mongoose connection state).

At this point, everything matches the instructions and works outside FCC. But the FCC test runner doesn’t seem to detect the version or connection.

My question:

Is this a known issue with the test runner? Are there specific requirements about hosting providers, endpoint path, or headers that could cause FCC not to detect the setup even through it’s working?

Any guidance would be greatly appreciated!

PS: I want to apologize for the very long post. I’ve been stuck and working on this lecture for days and the frustration has been increasing through the roof. I just want to make sure I’ve explained everything clearly so others can understand the situation and hopefully help me figure out what’s going wrong.

Thanks in advance!

W

I used a local setup to complete this course. So it may be worth trying that next if you can’t get your railway project to pass.

Meantime, you should share a link to your repo so people can check that you made the requirements mentioned in the step. (You should also really share a link to the step for convenience)

Are you sure you started out with a clone of the fcc repo?

I finally got it working! I was using my own custom setup instead of using the offical FCC boilerplate repo on GitHub :melting_face:

Basically I took the repo from FCC and then pushing it to Railway. Once I forked the boilerplate, added my MongoDB Atlas connection string (with the correct database name in the URI), and deployed, everything lined up the way FCC’s tests expect.

Thanks anyway for the help :right_facing_fist:t5::left_facing_fist:t4:

that is good. What was wrong with it before?

Basically, I created my own custom setup instead of starting from the official FCC boilerplate. My code was running fine, and MongoDB was connected, but because the structure didn’t exactly match what FCC’s tests expect, the submissions kept failing. Once I switched to the boilerplate and followed the same structure FCC wanted, I added to my Atlas connection and the tests passed.

1 Like

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