Skip to content

Tanstack Start: Asset hash mismatch between client and server-side (SSR) assets in Dockerfile build #4959

@58bits

Description

@58bits

Which project does this relate to?

Start

Describe the bug

This is a follow up issue from this discussion here:

#4952

As described in the title, there is an incorrect CSS asset hash value in the server bundle chunk ssr.mjs when attempting to build a Dockerfile image and start the Docker container.

In the Docker container - the entry for appCss in .output/server/chunks/_/ssr.mjs is...

const appCss = "/assets/global-KecCYkUG.css"; - which does NOT exist in the assets directory.

However, in all local builds it is and should be:

const appCss = "/assets/global-DOuTEoU0.css"; - which DOES exist in the assets directory.

(Note: actual hash values have likely changed after attempts at solving this with modified CSS style sheets - but the core problem remains)

Your Example Website or App

https://github.com/Modulus-Learning/registry

Steps to Reproduce the Bug or Issue

pnpm install, pnpm build, pnpm start - to install and run the project locally.

Then build the docker image using the following shell commands from the root of the project:

./_docker/build-prod.sh

And then start the Docker container via:

./_docker/exec-prod.sh up

Visit the docker hosted website on http://localhost (on port 80) and look for console errors in the browser.

NOTE: There is a simplified Dockerfile and instructions in the root of the project that uses npm as opposed to pnpm - although this is there only for diagnostics. The problem is the same whether using the project Dockerfile, in _docker/web/production/Dockerfile or the Dockerfile in the root.

If you'd like to use the Dockerfile in the root - do the following:

docker build --file Dockerfile --tag modulus_registry_test:app-1.0 .

docker compose --project-directory . --file ./docker-compose.yml --project-name modulus-registry-app up

Expected behavior

As a user I expect to be able to load the Docker hosted website without console 404 errors - asset URL not found, and theme and other Web application features should work as expected.

Screenshots or Videos

No response

Platform

  • Router / Start Version: ^1.131.11
  • OS: Linux/Ubuntu 24 LTS
  • Browser: Chrome
  • Browser Version: latest
  • Bundler: Vite
  • Bundler Version: ^7.1.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    startEverything about TanStack Start

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions