Repository navigation
Fix runtime crash: keep the node_modules tree bun install produced - #3
Merged
Merged
Conversation
The api and worker images built cleanly and then crashed on boot: error: Cannot find module '@libsql/client' from '/app/packages/db/src/client.ts' Bun does not hoist every workspace dependency to the root node_modules — some land in the package's own node_modules. The runtime stage copied only /app/node_modules and then re-copied packages/ from the build context, deleting those per-package trees. Both runtime stages now extend deps, which keeps the exact tree bun install produced. Dev dependencies ship in the image as a result; correctness is worth more than the size. Adds a smoke job to CI. The docker job only ever proved an image builds, which is why this reached production — the new job boots the container and waits for /health/live, failing fast on a crashloop. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The api and worker images built cleanly and then crashed on boot in production:
Cause
Bun does not hoist every workspace dependency to the root
node_modules— some land in the package ownnode_modules. The runtime stage copied only/app/node_modulesand then re-copiedpackages/from the build context, deleting those per-package trees.Both runtime stages now extend
deps, which keeps the exact treebun installproduced. Dev dependencies ship in the image as a result; correctness is worth more than the size, and this can be tightened later with a pruned install once there is a smoke test guarding it.This is the same root cause as the earlier
next: command not foundin the web image, which was fixed the same way. It should have prompted a check of the other two Dockerfiles at the time, and did not.Why it reached production
The
dockerCI job only ever proved that an image builds. Nothing ever started a container.This PR adds a
smokejob that boots the api and worker images and waits for/health/live, failing fast if the container exits early rather than waiting out the timeout. Both would have failed on the previous commit.Verification
CI now covers: format, typecheck, 265 tests, migrations against an empty database, PWA build, three image builds, and two container boots.
🤖 Generated with Claude Code