Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following error shows on all admin pages:
TypeError: 'undefined' is not an object (evaluating 'Drupal.ajax.prototype')
The error comes from on the second line:
$(function() {
Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display;
Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss;
});
This is from ctools/js/modal.js
Comments
Comment #1
DamienMcKennaFYI the error does not occur when the page is reloaded, only on the first page load.
Comment #2
DamienMcKennaAfter further debugging I realized this happens when all of the JS files haven't been compiled yet, e.g. there are six JS files being loaded, two of them give a 404 error so some of the necessary functionality isn't loaded; on subsequent page loads everything works because the missing files have been compiled.
Any idea why this might happen? Shouldn't the missing files be generated on demand?
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedGenerating on demand should happen. When you get a 404 for the JS what does the raw HTML for that 404 page look like?
Comment #4
DamienMcKennaThis affects all pages, not just admin pages.
Comment #5
DamienMcKenna@mikeytown2: Firefox's network inspector shows a full Drupal 404 page when the JS files don't load.
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commentedAdvAgg's 404 is similar to a fast404, very light. This means that Drupal is not passing this request along to advagg. Status report everything ok?
Comment #7
DamienMcKennaAs it turned out I hadn't cleared the caches - I thought I had but must have forgotten about it. Once I cleared the caches everything worked a-ok.
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commentedHad me sweating there for a second. Glad to hear it is ok :)