Repository navigation
fix(docker): ship packages/shared's nested node_modules to runtime - #1875
Conversation
|
Warning Review limit reached
Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
No issues found across 1 file
Auto-approved: Fixes crash-loop by copying nested shared/node_modules into runtime images, mirroring existing app node_modules copies. Bounded, deterministic fix for a missing directory causing ERR_MODULE_NOT_FOUND.
Re-trigger cubic
lucky-staging-backend is crash-looping:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'axios'
imported from /app/packages/shared/dist/services/LyricsService.js
npm nests a dependency under packages/shared/node_modules instead of
hoisting it when another workspace pins a conflicting range. packages/
frontend also depends on axios, so the lock now places axios@1.18.1 at
packages/shared/node_modules/axios rather than node_modules/axios. This
started with #1869 (npm audit remediation), which rewrote the lock.
deps-production already copies that directory (L122) and prunes devDeps,
but production-bot and production-backend never forwarded it, so
shared/dist imported packages the image did not contain.
Copies the whole directory rather than naming axios: zod is nested there
too and is also a runtime dep of shared, so it was the next crash. The
rest nested there are devDeps and are already pruned.
Verified on the images: prod 597f2cf (pre-#1869) has node_modules/axios
at 1.16.1 and is healthy; staging-8011a29 has neither
node_modules/axios nor packages/shared/node_modules.
96d089a to
b5712ab
Compare
|
🤖 I have created a release *beep* *boop* --- <details><summary>2.37.2</summary> ## [2.37.2](v2.37.1...v2.37.2) (2026-07-26) ### Bug Fixes * **docker:** ship packages/shared's nested node_modules to runtime ([#1875](#1875)) ([6516ad2](6516ad2)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Release 2.37.2 fixes the Docker image to include `packages/shared`’s nested `node_modules`. This prevents missing dependency errors when running in production. <sup>Written for commit 5d996bc. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/LucasSantana-Dev/Lucky/pull/1891?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->



Symptom
lucky-staging-backendis crash-looping on the host:Production is unaffected only because it predates the cause. It runs
597f2cf(v2.36.1, 2026-07-16); the next production deploy frommainwould break identically.Root cause
npm nests a dependency under
packages/shared/node_modulesinstead of hoisting it when another workspace pins a conflicting range.packages/frontendalso depends on axios, so the lockfile now resolves:with no
node_modules/axiosat the root. That changed in10b4a8cb(#1869, npm audit remediation), which rewrotepackage-lock.json.deps-productionalready copies that directory (Dockerfile L122) and prunes devDeps from it, butproduction-botandproduction-backendnever forwarded it. They copy rootnode_modules,packages/<app>/node_modulesandpackages/shared/dist, soshared/distimported packages the image did not contain.Evidence
node_modules/axiospackages/shared/node_moduleslucky-backend:597f2cf(prod)lucky-backend:staging-8011a29Fix
Forward
packages/shared/node_modulesinto both runtime stages, mirroring the existingpackages/<app>/node_modulescopies.Copies the whole directory rather than naming axios, because
zodis nested there too and is also a runtime dependency of shared, so it was the next crash waiting. Nested entries underpackages/shared:The devDeps are already stripped by the
npm prune --omit=devindeps-production, so this adds no image bloat.Why not force hoisting instead
Adding axios to the root manifest or running
npm dedupewould treat the symptom and stay fragile: any future range conflict in any workspace re-nests a dependency and breaks runtime again, silently, at container start. Copying the directory is deterministic and symmetric with what the bot and backend packages already get.Verification
Pending CI: once the image builds, confirm
/app/node_modules/axiosor/app/packages/shared/node_modules/axiosresolves inproduction-backend, then that staging comes up healthy rather than restarting.Summary by cubic
Ship
packages/shared/node_modulesinto both bot and backend runtime images to fix staging crashes from missing nested deps (axios,zod) imported bypackages/shared/dist.packages/shared/node_modulesfromdeps-productionintoproduction-botandproduction-backendstages.ERR_MODULE_NOT_FOUND.Written for commit b5712ab. Summary will update on new commits.