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

DamienMcKenna’s picture

Title: Error on all admin pages: TypeError: 'undefined' is not an object (evaluating 'Drupal.ajax.prototype') » Error when admin pages loaded first time: TypeError: 'undefined' is not an object (evaluating 'Drupal.ajax.prototype')

FYI the error does not occur when the page is reloaded, only on the first page load.

DamienMcKenna’s picture

After 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?

mikeytown2’s picture

Generating on demand should happen. When you get a 404 for the JS what does the raw HTML for that 404 page look like?

DamienMcKenna’s picture

Title: Error when admin pages loaded first time: TypeError: 'undefined' is not an object (evaluating 'Drupal.ajax.prototype') » Error when pages loaded first time: TypeError: 'undefined' is not an object (evaluating 'Drupal.ajax.prototype')

This affects all pages, not just admin pages.

DamienMcKenna’s picture

@mikeytown2: Firefox's network inspector shows a full Drupal 404 page when the JS files don't load.

mikeytown2’s picture

AdvAgg'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?

DamienMcKenna’s picture

Status: Active » Closed (works as designed)

As 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.

mikeytown2’s picture

Had me sweating there for a second. Glad to hear it is ok :)