📃 트러블 슈팅

빌드된 파일로 서비스 실행 시 protobuf를 찾지 못하는 문제

  1. 문제 정의

  2. 사실 수집

    Protobuf 파일 로드 중 오류가 발생했습니다: Error: ENOENT: no such file or directory, scandir 'D:\\github\\super-convergenc
    │ e-msa-server\\apps\\ice\\protobuf'
    │     at Object.readdirSync (node:fs:1506:26)
    │     at O (file:///D:/github/super-convergence-msa-server/apps/ice/dist/server.js:1:820)
    │     at L (file:///D:/github/super-convergence-msa-server/apps/ice/dist/server.js:1:967)
    │     at C.initialize (file:///D:/github/super-convergence-msa-server/apps/ice/dist/server.js:1:6020)
    │     at C.start (file:///D:/github/super-convergence-msa-server/apps/ice/dist/server.js:1:6075)
    │     at file:///D:/github/super-convergence-msa-server/apps/ice/dist/server.js:8:436
    │     at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
    │     at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
    │     at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5) {
    │   errno: -4058,
    │   code: 'ENOENT',
    │   syscall: 'scandir',
    │   path: 'D:\\\\github\\\\super-convergence-msa-server\\\\apps\\\\ice\\\\protobuf'
    │ }
    
  3. 원인 추론

  4. 해결 방안

    1. proto 파일도 같이 빌드 시킨다.

      → 컨테이너로 배포할 때 결국 포함시켜야 함. → 시도

    2. 상위에 있는 proto 파일을 읽어오게 경로를 수정한다.

      → 컨테이너로 배포할 때 결국 수정해야 함. → 기각

  5. 해결 시도

  6. 해결

    컨테이너로 배포 시에도 같은 node_modules 폴더의 protobuf를 참조하기 때문에 문제 발생 x