Error re-indexing courses
mrtndwrd opened this issue · 3 comments
mrtndwrd commented
I'm not sure if this is just me, but for years we have been getting this error when we run the course reindex command:
$ python manage.py cms reindex_course --all --settings=tutor.production
...
2022-09-13 08:36:28,665 ERROR 10 [edx.modulestore] [user 0] [ip x.x.x.x] courseware_index.py:263 - Indexing error encountered, courseware index may be out of date course-v1:Totem+TP_SM_RU+001 - TypeError("a bytes-like object is required, not 'str'")
Traceback (most recent call last):
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 258, in index
prepare_item_index(item, groups_usage_info=groups_usage_info)
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 218, in prepare_item_index
prepare_item_index(
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 218, in prepare_item_index
prepare_item_index(
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 218, in prepare_item_index
prepare_item_index(
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 181, in prepare_item_index
item_index_dictionary = item.index_dictionary()
File "/openedx/venv/lib/python3.8/site-packages/video_xblock/video_xblock.py", line 905, in index_dictionary
content_ = self.vtt_to_text(content)
File "/openedx/venv/lib/python3.8/site-packages/video_xblock/mixins.py", line 109, in vtt_to_text
if '-->' in line or line == '':
TypeError: a bytes-like object is required, not 'str'
2022-09-13 08:36:28,667 ERROR 10 [root] [user 0] [ip x.x.x.x] reindex_course.py:105 - Error indexing course course-v1:Totem+TP_SM_RU+001 due to the error: Error(s) present during indexing
Traceback (most recent call last):
File "/openedx/edx-platform/cms/djangoapps/contentstore/management/commands/reindex_course.py", line 103, in handle
CoursewareSearchIndexer.do_course_reindex(store, course_key)
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 373, in do_course_reindex
return cls._do_reindex(modulestore, course_key)
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 383, in _do_reindex
indexed_count = super()._do_reindex(modulestore, structure_key)
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 281, in _do_reindex
indexed_count = cls.index(modulestore, structure_key)
File "/openedx/edx-platform/cms/djangoapps/contentstore/courseware_index.py", line 271, in index
raise SearchIndexingError('Error(s) present during indexing', error_list)
cms.djangoapps.contentstore.courseware_index.SearchIndexingError: Error(s) present during indexing
...
I'm not sure if this is because some database migration has gone wrong on our side a long time ago, or if we're just the only ones looking at the output of the course reindexing.
This is the rather simple fix for that problem:
If it's the same for you I wouldn't mind making a PR, or feel free to apply this fix yourself.
dyudyunov commented
Thank you for opening the issue!
We'll check it on our instances
dyudyunov commented
I was able to reproduce the issue. I'll update you when I'll investigate it deeper.
Note: not all the courses with the video xblock affected
andrewhippo3 commented