Create/Update Comments, movieActions.js syntax error

In Chapter 3: User-Facing Backend Ticket: Create/Update Comments, i am trying to make a comment but because of the js error AddCommentAsync doesn’t trigger.

error: SyntaxError
columnNumber: 0
fileName: “”
lineNumber: 0
message: "JSON.parse: unexpected end of data at line 1 column 1 of the JSON data"​​
stack: “”

Hi @omer_faruk_31565,

I have initiated a discourse inbox message thread, you can reply there with your code.

Please feel free to reach out if you have any questions.

Thanks,
Sonali

1 Like

i know there are a lot of this kind of issues but it’s been 5 days already, because of this i am at the same spot in the course for 5 days, a little bit hurry please.

Hi @omer_faruk_31565,

Sorry for the delay. Can you please share the code changes you have made for this ticket?

Kanika

But the problem is not in the AddCommentAsync method because i can t even debug the AddCommentAsync , i think its front end based but i might be wrong

   public async Task<Movie> AddCommentAsync(User user, ObjectId movieId, string comment,
    CancellationToken cancellationToken = default)
{
    try
    {
        var newComment = new Comment
        {
            Date = DateTime.UtcNow,
            Text = comment,
            Name = user.Name,
            Email = user.Email,
            MovieId = movieId
        };

        // Ticket: Add a new Comment
        // Implement InsertOneAsync() to insert a
        // new comment into the comments collection.

        await _commentsCollection.InsertOneAsync(newComment, cancellationToken: cancellationToken);

        return await _moviesRepository.GetMovieAsync(movieId.ToString(), cancellationToken);
    }
    catch
    {
        return null;
    }
}

Please check the messages.

Kanika

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