Frappe Docker Assets (JS & CSS) Return 404 – `bench build` Breaks All Assets

Title:
:rotating_light: Custom App Assets (JS & CSS) Return 404 – bench build Breaks All Assets


Post:

Hi everyone,
I’m currently facing a very frustrating issue related to custom app assets not loading.


:exclamation: Problem:

  • All JS and CSS files from my custom app are returning 404 Not Found in the browser.
  • The file paths are correct, for example:
customapp/public/js/custom_script.js
customapp/public/css/custom_style.css

:test_tube: What I’ve Tried:

  1. Ran:
bench build --app customapp

→ But the result is still the same: assets not found.
2. Ran:

bench build

→ This made it worse:

  • All assets (Frappe, ERPNext) became broken.
  • The site is no longer usable due to missing JS/CSS from core apps.
  1. Checked Redis:
  • I verified in pwd.yml and compose_redis.yml – there is no Redis cache data left, so it shouldn’t be the issue.

:white_check_mark: Confirmed:

  • hooks.py is correctly configured and includes:
app_include_js = "/assets/customapp/js/custom_script.js"
app_include_css = "/assets/customapp/css/custom_style.css"
  • public/ folder is correctly structured.
  • After running bench build, the assets do appear under sites/assets/customapp.
  • I also already have a build.json in place.

:question: My Questions:

  • Why are the assets still returning 404 even though everything seems correctly built and placed?
  • Is there a safe way to rebuild only the custom app’s assets without breaking the core ones?
  • Could this be a Docker volume or permission issue?

I’m really stuck and this issue is stressing me out. Any help would be greatly appreciated. :pray:
Thanks in advance!

problem video is here https://youtu.be/QmM8qoG3HbE

Problem is in your hook.py

Do this thing instead.

  1. Create one bundle file in public/js like customapp.bundle.js
  2. in that file import your js files
import "./custom_script"
  1. in hooks.py add
app_include_js = "customapp.bundle.js"

Same for css

I have done the steps that you gave, such as:

add the bundle in public/js and add it to hook.py

import my public/js file in the bundle file
Screenshot 2025-05-21 143550

but here I still have the same problem that my assets are not detected.

i have try that but it still can’t or maybe that because redis cache?

still yours hook.py is wrong

it should be like

app_include_js = "customapp.bundle.js"

I have done this method but still can’t