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:
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.
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.
You must use a permanent live project url when submitting. If you submit one that is only temporarily live, then FCC can not audit the project at a later date.
If you have tried to use Glitch, can you post a link to the version that will show your code, so we can test it?
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:
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.
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!
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