June 23, 2021

Discussion Forum Open edX Not Visible for Single User

Activities, Android Developer, Ansible, Apache2, Atlassian, Ayo Belajar Linux, Bestpath Network, BLC Telkom Klaten, BSD, Caddy Server, Case Study, Cisco, Cisco Indonesia, Cloud Computing, Cockpit, Custom Weapons, Docker, E-Learning, Engenius, Error, FreeBSD, FreeBSD Indonesia, Komunitas Pengguna Linux Indonesia, KPLI Bulukumba, KPLI Klaten, Let's Encrypt, Linux, MacOS, Microsoft Azure, Microsoft SQL Server, MikroTik, MikroTik Indonesia, MySQL, Nginx, Open edX, OpenSID, Others, PHP, phpMyAdmin, PostgreSQL, Proxmox, Python, Redash, Sendy, SSH, Stories, Subnetting, TP-Link, Ubiquiti, Unix, Virtualization, Windows, X-Mosque, Faizar Septiawan, Icar, siBunglonGanteng, Orang Ganteng, siBunglonLabs

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

Google Groups