Skip to content

Comments

fix(docker): prevent static asset 404s by waiting for webpack dev server#38161

Open
rusackas wants to merge 1 commit intomasterfrom
fix/docker-static-assets-race-condition-30183
Open

fix(docker): prevent static asset 404s by waiting for webpack dev server#38161
rusackas wants to merge 1 commit intomasterfrom
fix/docker-static-assets-race-condition-30183

Conversation

@rusackas
Copy link
Member

SUMMARY

Fixes a race condition in the Docker development setup where nginx starts before the webpack dev server is ready, causing 404 errors for all static assets (/static/assets/images/superset-logo-horiz.png, etc.).

Root Cause:
When running docker compose up, nginx starts immediately and proxies /static requests to port 9000. However, the superset-node container needs time to:

  1. Run npm install (can take several minutes)
  2. Start the webpack dev server

During this startup period, all static asset requests fail with 404 errors.

The Fix:

  1. Added a health check to superset-node that verifies the webpack dev server is responding on port 9000
  2. Added depends_on: superset-node: condition: service_healthy to nginx so it waits for the frontend to be ready

The health check uses Node.js (already in the container) to make HTTP requests, with a 60-second start period and up to 30 retries at 10-second intervals (5+ minutes total wait time).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: Static assets return 404 during startup, broken UI
After: Nginx waits for webpack dev server to be healthy before starting

TESTING INSTRUCTIONS

  1. Clean your Docker environment:

    docker compose down -v
    docker builder prune --all --force
  2. Start fresh:

    docker compose up
  3. Watch the logs - you should see:

    • superset-node running npm install and starting dev server
    • nginx waiting (health check retrying)
    • nginx starting only after superset-node is healthy
  4. Access http://localhost - static assets should load correctly

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

When running `docker compose up`, nginx would start immediately and begin
proxying `/static` requests to port 9000 (webpack dev server) before the
`superset-node` container had finished running `npm install` and starting
the dev server. This resulted in 404 errors for all static assets.

This fix adds:
1. A health check to `superset-node` that verifies the webpack dev server
   is responding on port 9000
2. A `depends_on` condition on `nginx` that waits for `superset-node` to
   be healthy before starting

The health check:
- Uses Node.js (already available in the container) to make HTTP requests
- Has a 60-second start period to allow for `npm install`
- Retries up to 30 times at 10-second intervals (5+ minutes total)
- Prevents nginx from proxying to a non-existent server

Fixes #30183

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dosubot
Copy link

dosubot bot commented Feb 22, 2026

Related Documentation

Checked 0 published document(s) in 2 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 22, 2026

Bito Automatic Review Skipped - Files Excluded

Bito didn't auto-review this change because all changed files are in the exclusion list for automatic reviews. No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the excluded files settings here, or contact your Bito workspace admin at evan@preset.io.

@dosubot dosubot bot added the infra:container Infra container and K8s label Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra:container Infra container and K8s size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker bug: werkzeug/utils.py" in send_from_directory

1 participant