Error in Custom Theme When Upgrading from Koa -> Nutmeg

Good morning team!

We are working on upgrading from Koa → Nutmeg using tutor. We have a custom theme that we are trying to continue to use.

We are setting the following waffle_flags:

tutor local run lms ./manage.py lms waffle_flag courseware.use_legacy_frontend --everyone --create
tutor local run lms ./manage.py lms waffle_flag course_home.course_home_use_legacy_frontend --everyone --create

We have tested the upgrade on a Nutmeg instance with these settings and without our theme and we can pull the course up.

We are currently testing with the demo course:

tutor local importdemocourse

When we apply our custom theme we see the following error in the LMS container:

2023-02-11 12:49:36 2023-02-11 18:49:36,655 INFO 7 [openedx.core.djangoapps.cors_csrf.helpers] [user 4] [ip 172.20.0.1] helpers.py:64 - Origin 'http://local.overhang.io' was not in `CORS_ORIGIN_WHITELIST`; full referer was 'http://local.overhang.io/dashboard' and requested host was 'local.overhang.io'; CORS_ORIGIN_ALLOW_ALL=False
2023-02-11 12:49:36 2023-02-11 18:49:36,813 ERROR 7 [edx.courseware] [user 4] [ip 172.20.0.1] views.py:751 - Error in /courses/course-v1:myUx+CS101+2023_T3/courseware/9d670837cfb747b492a554656492dd4d/970031faf627492c931f7b8678c29e72/1: user=justin-jones-myU, effective_user=justin-jones-myU, course=course-v1:myUx+CS101+2023_T3
2023-02-11 12:49:36 Traceback (most recent call last):
2023-02-11 12:49:36   File "/openedx/edx-platform/./lms/djangoapps/courseware/views/index.py", line 154, in get
2023-02-11 12:49:36     return self.render(request)
2023-02-11 12:49:36   File "/openedx/edx-platform/./lms/djangoapps/courseware/views/index.py", line 260, in render
2023-02-11 12:49:36     return render_to_response('courseware/courseware.html', self._create_courseware_context(request))
2023-02-11 12:49:36   File "/openedx/edx-platform/./lms/djangoapps/courseware/views/index.py", line 496, in _create_courseware_context
2023-02-11 12:49:36     courseware_context['fragment'] = self.section.render(self.view, section_context)
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/xblock/core.py", line 198, in render
2023-02-11 12:49:36     return self.runtime.render(self, view, context)
2023-02-11 12:49:36   File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 2186, in render
2023-02-11 12:49:36     return self.__getattr__('render')(block, view_name, context)
2023-02-11 12:49:36   File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1428, in render
2023-02-11 12:49:36     return super().render(block, view_name, context=context)
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/xblock/runtime.py", line 847, in render
2023-02-11 12:49:36     frag = view_fn(context)
2023-02-11 12:49:36   File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 490, in student_view
2023-02-11 12:49:36     return self._student_or_public_view(context, prereq_met, prereq_meta_info, banner_text)
2023-02-11 12:49:36   File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 621, in _student_or_public_view
2023-02-11 12:49:36     fragment.add_content(self.runtime.service(self, 'mako').render_template("seq_module.html", params))
2023-02-11 12:49:36   File "/openedx/edx-platform/common/djangoapps/edxmako/services.py", line 30, in render_template
2023-02-11 12:49:36     return render_to_string(template_file, dictionary, namespace=self.namespace_prefix + namespace)
2023-02-11 12:49:36   File "/openedx/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 178, in render_to_string
2023-02-11 12:49:36     return template.render(dictionary, request)
2023-02-11 12:49:36   File "/openedx/edx-platform/common/djangoapps/edxmako/template.py", line 82, in render
2023-02-11 12:49:36     return self.mako_template.render_unicode(**context_dictionary)
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/mako/template.py", line 444, in render_unicode
2023-02-11 12:49:36     return runtime._render(
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 874, in _render
2023-02-11 12:49:36     _render_context(
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 916, in _render_context
2023-02-11 12:49:36     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 943, in _exec_template
2023-02-11 12:49:36     callable_(context, *args, **kwargs)
2023-02-11 12:49:36   File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/myU-theme/lms/templates/seq_module.html.py", line 44, in render_body
2023-02-11 12:49:36     __M_writer(filters.html_escape(filters.decode.utf8(ajax_url)))
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/mako/filters.py", line 47, in decode
2023-02-11 12:49:36     return decode(str(x))
2023-02-11 12:49:36   File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 230, in __str__
2023-02-11 12:49:36     raise NameError("Undefined")
2023-02-11 12:49:36 NameError: Undefined
2023-02-11 12:49:36 2023-02-11 18:49:36,868 ERROR 7 [django.request] [user None] [ip None] log.py:224 - Internal Server Error: /courses/course-v1:myUx+CS101+2023_T3/courseware/9d670837cfb747b492a554656492dd4d/970031faf627492c931f7b8678c29e72/1

This theme has worked fine with our Koa instance but, not on Nutmeg.
Is there a setting that we are missing?
Is there a way to set a break point in the docker container locally to further debug this?

Any suggestions or help with this error will be greatly appreciated.

Hi @justin-jones

According to your logs, an error was found in the file /myU-theme/lms/templates/seq module.html. The “ajax url” parameter is not defined in this file. Nutmeg changed the lms/templates/seq module.html file (https://github.com/openedx/edx-platform/blob/open-release/nutmeg.master/lms/templates/seq module.html#L7).

Therefore, you must duplicate the lms/templates/seq module.html file in your theme.

1 Like

@Mahendra

Thank you so much for the reply! I did a compare of those files I definitely missed that!

This solved that problem for me.

Thanks again for your quick reply and help.

I truly appreciate it!