Discussion Forum Open edX Not Visible for Single User
A few days ago, a students using our system reported that he couldn’t see the discussion forum on the course. But another student, discus forums can be seen.
When i check the LMS log, i found this:
Jun 21 18:15:01 velvet [service_variant=lms][edx.courseware][env:sandbox] ERROR [velvet 8339] [views.py:592] - Error in /courses/course-v1:STEL+Beginner+2020_Run1/discussion/forum/: user=chyntia, effective_user=chyntia, course=course-v1:STEL+Beginner+2020_Run1
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", line 521, in get
return super(CourseTabView, self).get(request, course=course, page_context=page_context, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/web_fragments/views.py", line 26, in get
fragment = self.render_to_fragment(request, **kwargs)
File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", line 656, in render_to_fragment
return tab.render_to_fragment(request, course, **kwargs)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/tabs.py", line 294, in render_to_fragment
return self.fragment_view.render_to_fragment(request, course_id=unicode(course.id), **kwargs)
File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/views.py", line 704, in render_to_fragment
base_context = _create_base_discussion_view_context(request, course_key)
File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/views.py", line 405, in _create_base_discussion_view_context
user_info = cc_user.to_dict()
File "/edx/app/edxapp/edx-platform/lms/lib/comment_client/models.py", line 59, in to_dict
self.retrieve()
File "/edx/app/edxapp/edx-platform/lms/lib/comment_client/models.py", line 64, in retrieve
self._retrieve(*args, **kwargs)
File "/edx/app/edxapp/edx-platform/lms/lib/comment_client/user.py", line 158, in _retrieve
self.save()
File "/edx/app/edxapp/edx-platform/lms/lib/comment_client/models.py", line 141, in save
metric_action='model.update'
File "/edx/app/edxapp/edx-platform/lms/lib/comment_client/utils.py", line 80, in perform_request
raise CommentClientRequestError(response.text, response.status_code)
CommentClientRequestError: ["Username is already taken"]
On google groups, someone also had this problem after deleting user on MySQL and then add a new user using the same username. The previous username has been registered in the forum database, because the student’s unique id is not same, when the new user opens the discussion forum, the forum service returns an error message “Username is already taken”
How to fix it?
Delete the user’s username in the mongoDB.
$ mongo
>> use cs_comments_service
>> db.users.find()
>> db.users.remove({username: "chyntia"})
After you delete it, users should be able to see the discussion forum.
Reference