Static resources not loading (404 errors)

Hi,

Using Jupiter release I was able to get it up and running. I’ve created a new course, release it, enroll on it as new student and tried to access its units. And here comes the first problem. I can’t see the content of the units that I created as a teacher from Studio. They appear empty.

Opening the browser console I can see that it is due to some 404 errors related to (at least) this file /static/bundles/commons.458daa1db45d1dc23784.js :

I’m aware of the bundling and caching services that lead to generate static file like the mentioned one.
In fact, I think that I’ve followed the correct procedure to generate them:

paver i18n_fastgenerate   
/edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py lms compilejsi18n --settings=production   
/edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py cms compilejsi18n --settings=production   
paver update_assets lms --settings=production
paver update_assets cms --settings=production

But clearly I’m missing something here… because that commons.458daa1db45d1dc23784.js file is missing.

I have double checked the bundles (/edx/var/edxapp/staticfiles/bundles) directory and there are a lot of commons.js files, with different hashes appended to their name but not the one that is generating the 404 error:

/edx/var/edxapp/staticfiles/bundles# ls -al commons.*
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 08:00 commons.086b08ea545cfb287374.fd858ba86dc2.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 07:59 commons.086b08ea545cfb287374.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Aug 31 17:49 commons.293de744c84a425d5c4e.7f815a0e2fc6.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Aug 31 17:47 commons.293de744c84a425d5c4e.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  2 21:48 commons.621de8533ec66a883646.b5df8174816b.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  2 21:46 commons.621de8533ec66a883646.js
-rw-r--r-- 1 edxapp edxapp 1975235 Jul 21 11:21 commons.6bd44dff6c01779c3458.ee257012f11b.js
-rw-r--r-- 1 edxapp edxapp 1975235 Jul 21 11:20 commons.6bd44dff6c01779c3458.js
-rw-r--r-- 1 edxapp edxapp 1973052 Jul 21 11:21 commons.88f51c90b3f7.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 13:32 commons.b854f1023b1771ec535e.3cae85bd056b.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 13:30 commons.b854f1023b1771ec535e.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 13:32 commons.c7045d26823d4903c4ef.1eb0f48245c0.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 13:30 commons.c7045d26823d4903c4ef.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  3 20:05 commons.fe6ebcad07a8581a9fba.68881ce2a7ce.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  3 20:03 commons.fe6ebcad07a8581a9fba.js
-rw-rw-r-- 1 edxapp edxapp 1973052 Sep  8 13:30 commons.js

But using the find command, I’ve also found this other bundles/ folder:

root@edx-juniper:/edx# ls -al /edx/app/edxapp/edx-platform/common/static/bundles/commons*
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 07:58 /edx/app/edxapp/edx-platform/common/static/bundles/commons.086b08ea545cfb287374.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Aug 31 17:46 /edx/app/edxapp/edx-platform/common/static/bundles/commons.293de744c84a425d5c4e.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 13:46 /edx/app/edxapp/edx-platform/common/static/bundles/commons.458daa1db45d1dc23784.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  2 21:46 /edx/app/edxapp/edx-platform/common/static/bundles/commons.621de8533ec66a883646.js
-rw-r--r-- 1 edxapp edxapp 1975235 Jul 21 11:19 /edx/app/edxapp/edx-platform/common/static/bundles/commons.6bd44dff6c01779c3458.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 08:09 /edx/app/edxapp/edx-platform/common/static/bundles/commons.b854f1023b1771ec535e.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  8 13:29 /edx/app/edxapp/edx-platform/common/static/bundles/commons.c7045d26823d4903c4ef.js
-rw-rw-r-- 1 edxapp edxapp 1975235 Sep  3 20:02 /edx/app/edxapp/edx-platform/common/static/bundles/commons.fe6ebcad07a8581a9fba.js
-rw-r--r-- 1 edxapp edxapp 1973052 Sep  8 13:46 /edx/app/edxapp/edx-platform/common/static/bundles/commons.js

And there it IS the missing file: commons.458daa1db45d1dc23784.js

So my questions are:

  • Which folder is the correct one? Why is my Open edX instance generating bundles in two different folders?
  • How can I force edX to generate the missing file in the correct folder?
  • If that is not possible, how can I debug my system to know why this file is not generated in bundles/?
  • Can I clean all the non-updated versions of js files from bundles/ folders (and other staticfiles subfolders)?
  • In which point is generated the hash suffix appended to the common.js file? (knowing that I think that I could trace the chain of errors that lead to get that file missing)

UPDATE: I was able to apply a workaround while trying to wrap my head around this problem. Just situated in /edx/var/edxapp/staticfiles/bundles, I ran this command:

ln -s /edx/app/edxapp/edx-platform/common/static/bundles/* .

to generate sof-links in the current folder to the files missing (and existing in /edx/app/edxapp/edx-platform/common/static/bundles/). It works, now I can see the missing content of my course, but this solution is a quick&dirty trick that I’d prefer to avoid in the future.

Thanks!

I have had to run both paver and collectstatic in Juniper to not run into this issue.

paver update_assets lms --settings=production
paver update_assets cms --settings=production
python manage.py cms --settings=production collectstatic --noinput
python manage.py lms --settings=production collectstatic --noinput

Thanks! Tomorrow I’ll give it a try and mark it as a solution if it works. Btw, what’s the purpose of the --noinput option?

@Juanan, I believe the purpose of --noinput is not be prompted if there are any questions from manage.py. I think I found the answer somewhere that had --noinput already so I have been using it.