Frappe Production Issue: 404 on Randomized website.bundle CSS File

Hello everyone,

I’m experiencing an issue on my Frappe production installation where the browser fails to load a CSS file. The error message in the console is:

Copy

Failed to load resource: the server responded with a status of 404 (Not Found) for the file http://[domain_removed]/assets/frappe/dist/css/website.bundle.J5AG376K.css

I’ve noticed that the filename includes a randomized string (in this case, J5AG376K). When I look in this location in my container the radom part is different.

To troubleshoot, I’ve already tried the following:

  • Running bench build
  • Running bench migrate
  • Clearing the cache

Unfortunately, none of these steps have resolved the issue.

Has anyone encountered a similar problem or have any suggestions on how to address this bundler-related error?

Thank you for your help!

1 Like

try bench update?

Interesting, this occured:
$ bench update
.ERROR: Command ‘git symbolic-ref -q --short HEAD’ returned non-zero exit status 128.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
^^^^^
File “/usr/local/lib/python3.11/site-packages/bench/cli.py”, line 132, in cli
bench_command()
File “/usr/local/lib/python3.11/site-packages/click/core.py”, line 1161, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/click/core.py”, line 1082, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/click/core.py”, line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/click/core.py”, line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/click/core.py”, line 788, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/bench/commands/update.py”, line 59, in update
update(
File “/usr/local/lib/python3.11/site-packages/bench/utils/bench.py”, line 458, in update
validate_branch()
File “/usr/local/lib/python3.11/site-packages/bench/utils/bench.py”, line 645, in validate_branch
branch = get_current_branch(app)
^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/bench/utils/app.py”, line 175, in get_current_branch
return get_cmd_output(“git symbolic-ref -q --short HEAD”, cwd=repo_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/bench/utils/init.py”, line 240, in get_cmd_output
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/subprocess.py”, line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/subprocess.py”, line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘git symbolic-ref -q --short HEAD’ returned non-zero exit status 128.

Maybe this could be the root cause?

1 Like

There are some issues with your Git configuration. Could you run the command git symbolic-ref -q --short HEAD in the Frappe app (cd apps/frappe)?

$ ls
CODEOWNERS SECURITY.md commitlint.config.jsesbuild node_modules realtime
CODE_OF_CONDUCT.md attributions.md crowdin.ymlfrappe node_utils.js sider.yml
LICENSE babel_extractors.csv cypressgenerate_bootstrap_theme.js package.json socketio.js
README.md codecov.yml cypress.config.jshooks.md pyproject.toml yarn.lock
$ git symbolic-ref -q --short HEAD
fatal: not a git repository (or any of the parent directories): .git
$

How are you trying to set up Frappe? Are you following a tutorial or video? If so, could you share the link? It seems like you haven’t run this command in the Frappe app folder (apps/frappe).

If you’re using containers, clear volume and restart redis cache.

I have it running in docker.

I deleted my cache volume and reinstalled and still have the same issue interesting.

For anyone looking to my solution I figured it out thanks to the help of @revant_one !
I opened the redis docker container in command line and used the following command:

redis-cli FLUSHALL
1 Like

Guys i am having the same issue only difference is, in my case redis-cli FLUSHALL did not work as well

I just had this problem. Fiddling around, the thing that worked for me was deleting the redis cache container, and letting it recreate itself. I’m not a docker expert, but i noticed the redis and db containers don’t actually get shut down and removed with the docker compose down command. So i had to track down and stop and remove them manually, something like this:

docker container ls | grep redis-cache
docker container rm <container id>

I later learned you can use docker compose down --remove-orphans which seems to work to shut down and clean up everything.

Hello @habn

If you used a single YAML file.

If redis is a service in the same docker compose file (same stack), then you should get it down/removed.

docker compose down

It will also get created and started when you do a:

docker compose up -d

 
If you used multiple YAML files (main+overrides)

If you used any overrides or non-standard name for docker compose main file, then you should run docker compose commands with the format:

docker compose -f docker-compose-main.yml -f docker-compose-redis.yml up -d

and

docker compose -f docker-compose-main.yml -f docker-compose-redis.yml up -d

In this case you should mention all the YAML file using the "-f" option.

I’m using the single pwd.yml that comes from the official frappe/frappe_docker github. So I don’t know why the regular docker compose down doesn’t shut every container/service down for me. It’s a complex compose file. I don’t understand all of it. But doing the second down command with --remove-orphans always works for me.

Hello @habn

Can you please share your pwd.yml (do not forget to redact any sensitive info) ?

Are there any errors or warnings when doing a docker down?