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.

hi misilot ,
when i execute this command

paver update_assets lms --settings=production

i have this error :

Traceback (most recent call last):
File “manage.py”, line 103, in
startup.run()
File “/openedx/edx-platform/lms/startup.py”, line 20, in run
django.setup()
File “/openedx/venv/lib/python3.8/site-packages/django/init.py”, line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py”, line 116, in populate
app_config.import_models()
File “/openedx/venv/lib/python3.8/site-packages/django/apps/config.py”, line 269, in import_models
self.models_module = import_module(models_module_name)
File “/opt/pyenv/versions/3.8.18/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 843, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/openedx/edx-platform/lms/djangoapps/bulk_email/models.py”, line 22, in
from openedx.core.djangoapps.course_groups.cohorts import get_cohort_by_name
File “/openedx/edx-platform/openedx/core/djangoapps/course_groups/cohorts.py”, line 21, in
from lms.djangoapps.courseware import courses
File “/openedx/edx-platform/lms/djangoapps/courseware/courses.py”, line 62, in
from openedx.features.course_experience.utils import is_block_structure_complete_for_assignments
File “/openedx/edx-platform/openedx/features/course_experience/utils.py”, line 8, in
from lms.djangoapps.course_api.blocks.api import get_blocks
File “/openedx/edx-platform/lms/djangoapps/course_api/blocks/api.py”, line 11, in
from openedx.features.effort_estimation.api import EffortEstimationTransformer
File “/openedx/edx-platform/openedx/features/effort_estimation/api.py”, line 7, in
from .block_transformers import EffortEstimationTransformer
File “/openedx/edx-platform/openedx/features/effort_estimation/block_transformers.py”, line 11, in
from edxval.api import get_videos_for_course
File “/openedx/venv/lib/python3.8/site-packages/edxval/api.py”, line 31, in
from edxval.models import (
File “/openedx/venv/lib/python3.8/site-packages/edxval/models.py”, line 300, in
class VideoImage(TimeStampedModel):
File “/openedx/venv/lib/python3.8/site-packages/edxval/models.py”, line 305, in VideoImage
image = CustomizableImageField()
File “/openedx/venv/lib/python3.8/site-packages/edxval/models.py”, line 213, in init
storage=get_video_image_storage(),
File “/openedx/venv/lib/python3.8/site-packages/edxval/utils.py”, line 158, in get_video_image_storage
return get_storage_class(
File “/openedx/venv/lib/python3.8/site-packages/storages/backends/s3.py”, line 282, in init
check_location(self)
File “/openedx/venv/lib/python3.8/site-packages/storages/utils.py”, line 99, in check_location
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: S3Storage.location cannot begin with a leading slash. Found ‘/edx/var/edxapp/media/’. Use ‘edx/var/edxapp/media/’ instead.