Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.

fix(deploy): restore dist src runtime paths - #193

Merged
oakinh merged 1 commit into
developfrom
fix/dev-deploy-type-only-import
Jun 8, 2026
Merged

oakinh merged 1 commit into
developfrom
fix/dev-deploy-type-only-import

Conversation

@oakinh

@oakinh oakinh commented Jun 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Restore production start paths to the built dist/src layout (dist/src/otel.js, dist/src/main.js).
  • Point the src module alias and bootstrap import back at dist/src so runtime absolute imports resolve.
  • Keep the generated Prisma client copy aligned with the compiled dist/src/generated/prisma import path.

Test plan

  • docker build -t election-api-dev-deploy-fix -f deploy/Dockerfile .
  • docker run --rm --entrypoint node election-api-dev-deploy-fix -e "require('./module-alias'); require('src/prisma/prisma.service.js'); require('./dist/src/generated/prisma'); console.log('runtime-paths-ok')"
  • docker run --rm --entrypoint node election-api-dev-deploy-fix -e "require.resolve('./dist/src/otel.js'); require.resolve('./dist/src/main.js'); console.log('entrypoint-files-ok')"

Root cause

The deploy image still builds into dist/src, but the SWC prep PR changed runtime references as if the image emitted a flat dist layout. ECS tasks could not start the app, so the service never became healthy and the deployment circuit breaker stopped the dev deploy.

Made with Cursor


Note

Medium Risk
Touches production entrypoints and module resolution; wrong paths would prevent containers from starting, but the change realigns paths with the existing build layout.

Overview
Restores production runtime paths so they match Nest’s dist/src build output instead of a flat dist layout that broke ECS deploys.

start:prod, deploy/entrypoint.sh, and module-alias.js now load ./dist/src/otel.js and dist/src/main.js, and map the src alias to dist/src so absolute src/... imports resolve. src/main.ts again imports module-alias from the app root via ../../module-alias (correct relative path from dist/src/main.js). The Dockerfile comment is updated to describe the dist/src/generated/prisma copy path; behavior is unchanged.

Reviewed by Cursor Bugbot for commit 131cb25. Configure here.

Keep the deploy entrypoint, module alias, and generated Prisma client copy aligned with the built dist/src layout so ECS tasks can start successfully.

Co-authored-by: Cursor <cursoragent@cursor.com>

@delegate-reviewer delegate-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@oakinh
oakinh merged commit ce6de1e into develop Jun 8, 2026
6 checks passed
@oakinh
oakinh deleted the fix/dev-deploy-type-only-import branch June 8, 2026 16:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant