WeBWorK Main Forum

Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Bianca Sosnovski -
Number of replies: 6

Hi everyone,

After upgrading to WeBWorK 2.19, we are experiencing the following issues:

  • Hints, solutions, and correct answers are not displaying.
  • The entry assistance tool (MathQuill) is not appearing, even though it is enabled with:
    #$pg{specialPGEnvironmentVars}{entryAssist} = 'MathQuill';
    
    in localOverrides.conf.

screenshot

I have already checked our configurations, and everything appears to be in order (pehaps not).

I came across a related discussion on the forum: https://webwork.maa.org/moodle/mod/forum/discuss.php?d=8560. However, unlike that case, we are not experiencing any issues with generating PDF files for problem sets—those seem to be working fine.

I have a meeting scheduled with our IT team to investigate the issue, but I’m unsure where to start troubleshooting.

Any insights or suggestions would be greatly appreciated!


In reply to Bianca Sosnovski

Re: Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Bianca Sosnovski -

Apologies, I forgot to mention that we updated the javascript and css using npm ci in the directories opt/webwork/webwork2/htdocs and /opt/webwork/pg/htdocs.

We also checked the Developer Tools Console for any issues. The only issue that appears is below (not sure if related to my initial inquiry):


  1. The Content Security Policy (CSP) prevents the evaluation of arbitrary strings as JavaScript to make it more difficult for an attacker to inject unathorized code on your site.

    To solve this issue, avoid using eval()new Function()setTimeout([string], ...) and setInterval([string], ...) for evaluating strings.

    If you absolutely must: you can enable string evaluation by adding unsafe-eval as an allowed source in a script-src directive.

    ⚠️ Allowing string evaluation comes at the risk of inline script injection.

  2. Affected Resources
    1. 1 directive
      1. Source locationDirectiveStatus
        script-srcblocked

In reply to Bianca Sosnovski

Re: Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Danny Glin -

Have you restarted the webwork2 service after running "npm ci"?

Double check that the files in /opt/webwork/webwork2/htdocs and /opt/webwork/pg/htdocs (and all subdirectories) are readable by the web server (though if this were the problem you would probably see errors in the console).

I'm not familiar with that Content Security Policy issue.  Does it occur with all browsers?  Does your institution have a proxy in front of your WeBWorK server?

In reply to Danny Glin

Re: Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Bianca Sosnovski -
Hi Danny,

Thanks for your reply.

Yes, we restarted the webwork2 service after running npm ci. I did it one more time after that, but the issue persists.

Regarding the upgrade, we encountered an issue during the process. After running npm ci, we installed the missing modules: Archive::Zip::SimpleZip, File::Copy::Recursive, GD::Barcode::QRcode, MIME::Base32, and SQL::Abstract. These installed without any problems.

However, XML::LibXML was also listed as missing, and its installation failed because it didn't pass all the tests in the build. We then attempted cpanm XML::LibXML --force as suggested, and the installation completed—but I’m wondering if this could be the root of the issue. I tried updating it again, but the same problem occurred.

I've thoroughly checked the settings in the server, and the configurations appear to be correct. However, I don’t see anything in the logs that explain why MathQuill isn't working or why solutions are only displaying as hints rather than functioning properly.

Additionally, faculty have reported that specific problems now display errors or warning messages, even though they worked fine before the upgrade. I was able to fix some, but a few remain unresolved.

We may need to rebuild the server (version 2.19) and migrate the user and course data. Let me know your thoughts.

Thanks again.
In reply to Bianca Sosnovski

Re: Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Glenn Rice -

If your server is running Ubuntu, then rather than installing LibXML::XML from cpan, I recommend installing the Ubuntu package libxml-libxml-perl.

However, none of the Perl dependencies will have anything to do with the MathQuill issues.  That is all JavaScript, and none of the Perl dependencies affect that.

You mentioned that you are getting the warning "Content Security Policy (CSP) prevents the evaluation of arbitrary strings" regarding usage of things like "eval" and "new Function" and such.  None of WeBWorK or PG's javascript uses any of those things.  However, one thing that can cause that is if the JavaScript and CSS files are not being loaded correctly.  From your screenshot I can see that the third party JavaScript and CSS seems to be working  (I see that the MathJax rendered), and the webwork2 JavaScript and CSS seem to be working (at least the Bootstrap styles are in effect which come from webwork2 css), but the PG JavaScript seems to not be working (MathQuill is in PG).  So the thing to focus on is /opt/webwork/pg/htdocs/.  Make sure that the file /opt/webwork/pg/htdocs/statis-assets.json exists and has content (running "npm ci" in the pg/htdocs directory creates that file among other things).  Also, if you are proxying via apache2 (or any other proxy or related sort of thing -- like a load balancer), then make sure that you the pg_files route is properly configured with the proxy.  If you are proxying via apache2, then check the conf/webwork2.apache2.4.conf file.

Note that the display errors for specific problems are most likely the same issue as the MathQuill issue since many problems use PG JavaScript and CSS.

Additional warnings in problems could also be due to a change that we made to make those warnings that used to only go into the apache2 error log be shown in the user interface.  That is intentional so that problem authors start fixing their coding issues.  Those warnings are only displayed for instructors and not for students though.

In reply to Glenn Rice

Re: Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Bianca Sosnovski -
Hi Glenn,

Thanks for your help!

It turned out that the issue stemmed from mixing old macro files (v2.16) with our newer server (v2.19). Following the suggestions in this forum post https://webwork.maa.org/moodle/mod/forum/discuss.php?d=8651, I was able to identify and resolve the problem. The issue I posted above was related to this.

Everything is now running smoothly on our new server.
In reply to Bianca Sosnovski

Re: Upgrade 2.19: Issues with Hints, Solutions, Correct Answer, and EntryAssist (MathQuill)

by Glenn Rice -
I saw that you followed Alex's suggestion of ensuring that local modifications weren't causing an issue.  I am glad you resolved the issue.