catalyst / moodle-auth_saml2

SAML done 100% in Moodle, fast, simple, secure
https://moodle.org/plugins/auth_saml2
71 stars 133 forks source link

RequireJS error 'Script error for "core/autoinitialize" in Totara 13 #766

Open agwells opened 1 year ago

agwells commented 1 year ago

When this plugin is installed in a Totara 13 site, it causes the requireJS loader to error out.

To replicate:

  1. Set up a clean install of Totara 13
  2. Add auth/saml2 plugin
  3. Access the site in a web browser

Expected result: The site loads successfully Actual result: The site loads but no JS functionality works. The console shows an error message Uncaught Error: Script error for "core/autoinitialize"

image

A look at the Developer Tools networking tab shows that there was a 500 error from the server attempting to load /lib/requirejs.php/-1/core/bundle.js. The response's body has this content:

JS file: /auth/saml2/amd/src/connectivity_test.js cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found.

image

image

It appears that the cause of this problem is that the file in question, /auth/saml2/amd/src/connectivity_test.js, is an ES5 module rather than an AMD module. Deleting the entire directory /server/auth/saml2/amd/src/ from my Totara source directory resolves the problem.