Failing fourth test for Exercise Tracker

What’s happening:
I have no idea why the fourth test is failing. All other tests are passing, but I have spent around 2.5 hours just on this one, and nothing seems to be working. The return format is not specified so I am returning a json object with keys [_id, username, duration, description, date]. Should the return format be different or something?
Thank you.

Code so far"/api/exercise/add", (req, resp) => {
  const { userId, description } = req.body;
  let { date, duration } = req.body;

  if (!(userId && description && duration)) {
    return resp.status(400).json({ msg: "Missing information" });
  if (date && Number.isNaN(Date.parse(date))) {
    return resp.status(401).json({
      msg: "'date' value is invalid "

  duration = Number.parseInt(duration);

  if (Number.isNaN(duration) || duration <= 0) {
    return resp.status(401).json({
      msg: "'duration' value is invalid "

    .then(user => {
      if (!user) {
        return resp
          .json({ msg: `User with id ${userId} not found` });

      if (!date) {
        date = new Date();
      } else {
        date = new Date(date);

      const exer = new Exercise({

        .then(newExer => {
          const finalObj = {
            _id: user._id,
            username: user.username,
            description: newExer.description,
            duration: newExer.duration,
            date: moment("YYYY-MM-DD"),
        .catch(err => {
          resp.status(500).json({ msg: "Internal Error" });
    .catch(err => {
      resp.status(500).json({ msg: "Invalid value for userId" });

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

Hello there,

We hope to get the user stories for this updated, but here is a useful thread to help you on your way:

Hope that helps

Thank you so much. I passed the test thanks to your guidance.