Error with preview and notes

Hi all,

At least in Nutmeg with Tutor 14.0.5, there is a problem when trying to preview or when hitting the link to a note in the student notes feature. The screen shows a message like “We’re sorry, this module is temporarily unavailable. Our staff is working to fix it as soon as possible.

The traceback shows problems related to chapter_completion_aggregator_url.

Traceback (most recent call last):
  File "/openedx/edx-platform/./lms/djangoapps/courseware/views/index.py", line 154, in get
    return self.render(request)
  File "/openedx/edx-platform/./lms/djangoapps/courseware/views/index.py", line 260, in render
    return render_to_response('courseware/courseware.html', self._create_courseware_context(request))
  File "/openedx/edx-platform/./lms/djangoapps/courseware/views/index.py", line 496, in _create_courseware_context
    courseware_context['fragment'] = self.section.render(self.view, section_context)
  File "/openedx/venv/lib/python3.8/site-packages/xblock/core.py", line 198, in render
    return self.runtime.render(self, view, context)
  File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 2186, in render
    return self.__getattr__('render')(block, view_name, context)
  File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1428, in render
    return super().render(block, view_name, context=context)
  File "/openedx/venv/lib/python3.8/site-packages/xblock/runtime.py", line 847, in render
    frag = view_fn(context)
  File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 490, in student_view
    return self._student_or_public_view(context, prereq_met, prereq_meta_info, banner_text)
  File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 621, in _student_or_public_view
    fragment.add_content(self.runtime.service(self, 'mako').render_template("seq_module.html", params))
  File "/openedx/edx-platform/common/djangoapps/edxmako/services.py", line 30, in render_template
    return render_to_string(template_file, dictionary, namespace=self.namespace_prefix + namespace)
  File "/openedx/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 178, in render_to_string
    return template.render(dictionary, request)
  File "/openedx/edx-platform/common/djangoapps/edxmako/template.py", line 82, in render
    return self.mako_template.render_unicode(**context_dictionary)
  File "/openedx/venv/lib/python3.8/site-packages/mako/template.py", line 444, in render_unicode
    return runtime._render(
  File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 874, in _render
    _render_context(
  File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 916, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 943, in _exec_template
    callable_(context, *args, **kwargs)
  File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/seq_module.html.py", line 146, in render_body
    __M_writer(filters.html_escape(filters.decode.utf8(chapter_completion_aggregator_url)))
  File "/openedx/venv/lib/python3.8/site-packages/mako/filters.py", line 47, in decode
    return decode(str(x))
  File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 230, in __str__
    raise NameError("Undefined")
NameError: Undefined

The problem was addressed by PR #30331 and will probably be merged in the next releases.

As a workaround, you can set COMPLETION_AGGREGATOR_URL with a tutor plugin to a non-empty value (like ‘https://’)