The discussion could not be loaded. Refresh the page and try again

Note: I’ve spent the last few hours trying to figure out what was causing this issue. I was able to figure out a solution. I’m posting this here for anyone else that might run into the same issue.

A user (ID 1379) reported seeing this message whenever they viewed a page that had a discussion forum control on it.

“The discussion could not be loaded. Refresh the page and try again”

Looking at the LMS logs, I found this request “GET /api/v1/users/1379?complete=True&request_id=09e6f162-d525-415f-a8a4-a1581cd956a9” was returning a 404.

Some digging through the forum code lead me to believe that the user 1379 was not created in the mongo database used by the forum.

Taking a look in the forum db users collection showed no users with an external_id of 1379:

tutor local run mongodb bash
mongo
use cs_comments_service
db.users.find({"external_id": "1379"})

Looking through the code some more, I came across the command reload_forum_users:

Running this command created the user and fixed the error:

tutor local run lms bash
./manage.py lms reload_forum_users

Hopefully posting this will save others some time.

Thanks for the thorough analysis @ToddLichty. Do you happen to know why the LMS user was not correctly inserted in Mongodb?

Unfortunately, I do not. I spent some time trying to figure that out but never found anything in the log files. If anyone has any ideas on what I should look for in the logs, I’m open to suggestions.