Back End Development and APIs Projects - Exercise Tracker

Hi, I’ve tried this project using local arrays and a proper MongoDB, assuming originally that I wasn’t passing the tests because I wasn’t using a backend database, I developed a solution that used MongoDB, which still doesn’t pass most of the tests.

I test these by forwarding my local 3000 port to a public url like “https://92f7-122-164-82-109.in.ngrok.io/” using ngrok, this might be the issue, but when I try to deploy the project on render, I get the following issue:


githubLink: GitHub - Aadhavan2307/implei-exercisetracker: A boilerplate for a freeCodeCamp project.

My browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

**Challenge:**Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

After making a few changes to a mistake in my code, which has been updated in the git, I am able to pass the following tests:

In the error message says you have incompatible version of node to do work that package (bson). You have to upgrade it. You can accomplish this in several ways, unistalling your current version of node and installing a new one or using npm or nvm to upgrade it.

I hope it helps.

I’m sorry for being a newb, but is this for the Render project? If so, could you suggest a few ways to update it?

There is nothing to sorry about it @aadhavan.shruthi !. Sure, here is a topic you can find this info: How to Update Node and NPM to the Latest Version

My node and npm are up to date, they run fine locally, it is only that I’m unable to port my project to something like Render or Glitch and run it… I am able to run it locally and forward it to a public IP, as my IP provider doesn’t allow for port forwarding, I use an app called ngrok to forward the local port 3000 to a public IP and submit that to FCC for tests, but the above mentioned tests fail… Sorry to trouble, but could you check whether my code is correct in the first place, because if I am going wrong there somewhere, I’ll have to change it, but when I manually do all the given tests, it does look like my code passes them.

Uhmm idk about ngrok. But according your information given, if in your local the same project is working fine, you have to make sure that your mapping from the public address is arriving to the correct folder. Im telling you this based on the attached package error, before to move on to see what is happening into your code (works in your local), see what is happening from the outside first (dependencies, node versions [node --version], etc ).

run the command node --version and make sure that your version is >= 14.20.1, after that you can delete the folder node_modules in your project and run the comman again for installing them. Try that to see if that works.

Like mentioned, you’ll get a lot more effective help if you post a live example rather than just a github, that way people can test your code directly without having to build a test environment.

I did notice for at least the get users output, you’re just directly sending the response from your Mongoose find method:

app.get("/api/users", async function(req, res){
  res.send(await User.find());
})

The project states you must return an array of user objects, are you sure that’s what User.find() is going to return? As browsers send GET requests, one way to check is to type the url with /api/users directly into your address bar and see how your browser responds. I was going to do it but again, you don’t have a public working model I could test it on.

When testing it running locally, you do not need Ngrok. After your code is passing, you can port it to something like Replit/Glitch or Render.

As for the Render deploy error try adding the Node Version.

Specifying a Node Version

Thanks to everyone for your suggestions!

This suggestion helped the most as it finally let me deploy on Render without errors and like everyone said, sending a publicly hosted response worked better and after changing a small issue with how I handled dates, all the tests have passed!

Thank you all again! :pray: :pray:

Hi Aadhavan
Well done on passing all the tests! I seem to be failing on the following test;

" The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added."

How did you format your response that you are sending back to the browser?

I’m able to successfully POST Exercise records, however my test is failing only on the above item only. All other of my tests pass successfully. Your help would be much appreciated

thanks
yattish

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