Forum

Thread tagged as: Problem, Error

JS files not loading in admin

I am seeing the following errors in the console: [Error] Did not load script at 'https://www.leadershiplive.tv/perch/core/assets/js/static/vendor.d4ea59dc48952cf4b3c6.js' because non script MIME types are not allowed when 'X-Content-Type: nosniff' is given. [Error] Did not load script at 'https://www.leadershiplive.tv/perch/core/assets/js/static/app.d4ea59dc48952cf4b3c6.js' because non script MIME types are not allowed when 'X-Content-Type: nosniff' is given. [Error] TypeError: undefined is not an object (evaluating 'Perch.Lang.init') Global Code (js_lang.php:1)

The site has recently been moved to a SSL cert and worked fine before that, any ideas ?

Basic Diagnostics

Perch: 3.1, PHP: 5.6.36, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: FreeBSD, apache2handler
Installed apps: content (3.1), assets (3.1), categories (3.1), perch_events (1.9.5), perch_forms (1.11), perch_members (1.6.3)
App runtimes: <?php $apps_list = array( 'perch_forms', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /usr/www/users/sotserver10/leadershiplive.tv/perch
PERCH_CORE: /usr/www/users/sotserver10/leadershiplive.tv/perch/core
PERCH_RESFILEPATH: /usr/www/users/sotserver10/leadershiplive.tv/perch/resources
Image manipulation: GD
PHP limits: Max upload 50M, Max POST 50M, Memory: 512M, Total max file upload: 50M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: www.leadershiplive.tv
DOCUMENT_ROOT: /usr/www/users/sotserver10/leadershiplive.tv
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Dave Buchholz

Dave Buchholz 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What mime type are you serving .js files as?

Drew,

I am not knowingly serving them as anything other than text/javascript, in safari's web inspector I see the type as js in the network tab.

To add, this issue is only occurring when I login to the perch admin, it doesn't happen on the front end of the site.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Try adding this to your config.php file:

define('PERCH_SECURITY_HEADERS', false);

Progress, I have a different error in the console now: [Error] SyntaxError: Unexpected token '<' (anonymous function) (vendor.d4ea59dc48952cf4b3c6.js:1) [Error] SyntaxError: Unexpected token '<' (anonymous function) (app.d4ea59dc48952cf4b3c6.js:1) [Error] TypeError: undefined is not an object (evaluating 'Perch.Lang.init') Global Code (js_lang.php:1)

Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like you have some sort of file corruption going on there. Try downloading a fresh copy of the files and going through the update steps to replace core.

ok, I will try that in a few minutes

Thanks that fixed the issue