Getting “Uncaught (in promise) SyntaxError: Unexpected token I in JSON at position 0” error when executing delete request


//Route 4 : Delete an existing note using DELETE "api/notes/deletenote". Login required
router.delete("/deletenote/:id", fetchuser, async (req, res) => {
  try {
    //find the note to be updated and update it
    let note = await Note.findById(req.params.id); //find note by id
    if (!note) {
      return res.status(404).send("Note Not found");
    } //If note is not found

    //allow deletion only if the user own the note

    if (note.user.toString() !== req.user.id) {
      return res.status(401).send("Not allowed");
    }      

    note = await Note.findByIdAndDelete(req.params.id, function (err, docs) { 
      if (err){ 
          console.log(err) 
      } 
      else{ 
          console.log("Deleted : ", docs); 
      } 
  });
    res.json({ Success: "Note has been deleted", note: note });
  } catch (error) {
    console.log(error.meassage);
    res.status(500).send("Internal server error");
  }
});

This is the code for the delete request in my backend and I am getting Uncaught (in promise) SyntaxError: Unexpected token I in JSON at position 0 error in my console and when I tested the request in thunderclient, its not working.

Please help me to resolve this problem.