3

When I try to create and new, or edit an existing, message template in 'Mailings' > 'Messsage Templates' I end up at a completely unstyled page. When I look at the console I see the following error:

Uncaught ReferenceError: CRM is not defined
at BtJa0AvQ:153

I then look at the 'file' that is being referenced and at the very last line I see:

})(CRM.$);

I have a Test server which is rendering the mail templates fine, it's simply the Prod server (which figures...) where I'm having this issue.

Any ideas where I can troubleshoot this issue?

I'm using the following:

  • Drupal 7.56
  • CiviCRM 4.7.22
  • PHP 5.5.38
  • Amazon Linux AMI release 2017.03
  • Apache 2.4.27

I'm only using one extension but that extension has nothing to do with mailing and was actually added well after this problem surfaced.

2
  • Can you please edit your question to indicate the CiviCRM version and CMS you're using? Are you using any extensions that affect mail, like Mosaico and/or Flexmailer? Commented Aug 31, 2017 at 15:56
  • Thanks for the updated info! I can give you some troubleshooting ideas now (see below) Commented Aug 31, 2017 at 16:11

2 Answers 2

2

Here are some places to check:

  • The JavaScript file name you mentioned shows that you're using aggregated JavaScript. To troubleshoot this, temporarily disable aggregated Javascript.
  • If that solves your problem by itself, it's probably just a caching issue. Clear caches and reenable JS aggregation. More likely though, it will just make debugging easier (e.g. by showing the actual JS file throwing the error).
  • Use the "Network" tab in your browser's developer tools once JS aggregation is off to look for 404 errors.
4
  • Thanks for the help. I do have JS aggregation turned off. I just added $config['system.performance']['js']['preprocess'] = TRUE; to my settings.php file as per the post that you linked to, just to verify. I'm still getting the same results. One of the errors I neglected to add to the error message is: 'civicrm/admin/messageTemplates/add?action=add&reset=1 500 (Internal Server Error)'
    – spinsheet
    Commented Aug 31, 2017 at 16:26
  • You may be getting the same results - but if your JS is no longer aggregated, then your console should report the JS error in a different filename, which should be a clue. Did you find any 404 errors? Commented Sep 1, 2017 at 1:13
  • I didn't see any 404 errors but there was the following 500 error: GET example.org/civicrm/admin/messageTemplates/… 500 (Internal Server Error) Where 'example' is replacing the actual URL. So for some reason even after setting my JS not to aggregate it's still aggregating.
    – spinsheet
    Commented Sep 1, 2017 at 12:50
  • I found that in the file sites/all/modules/civicrm/CRM/Utils/PDF/Document.php there is a line require_once 'TbsZip/tbszip.php that was throwing the following error in the Drupal logs: Warning: require_once(TbsZip/tbszip.php): failed to open stream: No such file or directory in require_once() (line 34 of /var/www/html/EXAMPLE/sites/all/modules/civicrm/CRM/Utils/PDF/Document.php). I commented that line out and now everything seems to work. Not sure what the repercussions of that are, or why it works on Test and not Prod.
    – spinsheet
    Commented Sep 1, 2017 at 15:45
2

I encountered the same issue and found that civicrm/packages/TbsZip/tbszip.php file is missing. Restoring the file fixed this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.