Skip to content

fix(site): ship React with the server so the image starts - #27

Merged
devchaudhary24k merged 2 commits into
mainfrom
fix/site-image-react
Oct 7, 2026
Merged

devchaudhary24k merged 2 commits into
mainfrom
fix/site-image-react

Conversation

@devchaudhary24k

@devchaudhary24k devchaudhary24k commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

What broke

v0.2.0 deployed, but the Site's new container never replaced the old one, so commitscape.damnlabs.com kept serving 0.1.1.

The v0.2.0 Site image answers every request, /api/health included, with a 500:

Error: Cannot find module 'react'
  at file:///app/.output/server/_ssr/cards-….mjs

Recharts, new in 0.2.0, reaches React through react-redux → use-sync-external-store, which loads it with require("react"). The bundle leaves that require to run at run time. In the repo and in CI's e2e there is a node_modules beside the output, so it resolves; the image has only /app/.output, so it fails. The health check never passes and Dokploy keeps the previous container.

The fix

  • apps/site/vite.config.ts: Nitro now traces react and react-dom into .output/server/node_modules, so the require finds them and every part of the Site uses that one copy.
  • apps/site/e2e/foundation.spec.ts: the repository page test pressed Ctrl+K before the page listened for it, which failed CI on main for the 0.2.0 commit. It now presses again until the palette is shown.

Checked

  • Built the Site Docker image from this branch and ran it: home, profile, Cards, Work, Standing, repository, Leaderboards, Versus, Races, Crews, Privacy, and Card SVG and PNG all answer 200, the log has no errors, and Docker reports it healthy.
  • The published v0.2.0 image, run the same way, answers 500 on /api/health and never becomes healthy.
  • The v0.2.0 Builder image starts and works; only the Site was affected.
  • pnpm check passes. The Card PNG timing test went over its 200 ms limit once on a loaded machine and passed on its own (33 of 33).
  • pnpm e2e: 58 of 58. The fixed test passed 8 of 8 when repeated.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Recharts reaches React through use-sync-external-store, which loads it
with require(). The server bundle left that require unresolved, so the
Docker image, which has no node_modules beside its output, failed every
request with "Cannot find module 'react'" and never became healthy.
Nitro now traces react and react-dom into the output, so every part of
the Site uses that one copy.
The test pressed Ctrl+K before the page had attached its shortcut, so
the palette sometimes never opened. It now presses again until the
palette is shown.
@devchaudhary24k
devchaudhary24k merged commit e903940 into main Oct 7, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant