daily report
Daily Report - 2026년 1월 4일
Beauty Insight Editor
Daily Report - 2026년 1월 4일
📋 작업 요약
1. GitHub 링크 업데이트
- 파일:
components/Dashboard.tsx - 변경 내용: Footer의 "View on GitHub" 링크를 새 저장소로 업데이트
- 이전:
https://github.com/Jae12ho/trade-dashboard - 이후:
https://github.com/Beauty-Insight-Lab-Inc/K-Beauty-Export-Tracker/tree/main
- 이전:
2. GitHub 저장소 초기 배포
- 로컬 Git 저장소 초기화 및 첫 커밋 완료
- 원격 저장소 설정:
https://github.com/Beauty-Insight-Lab-Inc/K-Beauty-Export-Tracker.git - 전체 프로젝트 코드 푸시 완료
3. Vercel 배포 및 커스텀 도메인 설정
- 도메인:
www.beautyinsightlab.com - 배포 가이드 작성:
deployment_guide.md생성- Vercel 프로젝트 설정 방법
- 환경 변수 구성
- 커스텀 도메인 연결 절차
- DNS 설정 가이드
4. 빌드 에러 수정
- 파일:
components/MiniChart.tsx - 문제: TypeScript 타입 에러 (Recharts Tooltip formatter)
- 해결:
value파라미터 타입을number에서any로 변경하여 타입 호환성 확보
5. 🔥 프로덕션 데이터 $0 버그 해결 (Critical)
문제 진단
- 증상: Vercel 프로덕션 환경에서 모든 차트 데이터가 $0로 표시
- 로그 분석:
[KoreaCustoms] Proxy Fetch Error: TypeError: fetch failed Error: connect ECONNREFUSED 127.0.0.1:3000
근본 원인 (Root Cause)
lib/api/korea-customs.ts가 내부 API 엔드포인트(/api/korea-customs)를localhost:3000으로 호출- Vercel의 서버리스 환경에서는 자기 자신에게 HTTP 요청 불가 (Network Isolation)
- 로컬 개발 환경에서는 정상 작동하지만, 프로덕션에서는 실패
해결 방법
Service Pattern 리팩토링으로 HTTP 루프백 제거:
-
새 파일 생성:
lib/api/customs-service.ts- Korea Customs API 호출 로직을 독립적인 서비스 함수로 추출
fetchStandardizedCustomsData()함수 구현- Redis 캐싱, XML 파싱, 에러 처리 포함
-
파일 수정:
lib/api/korea-customs.ts- 기존:
fetch('http://localhost:3000/api/korea-customs') - 변경:
import('./customs-service').fetchStandardizedCustomsData() - 효과: 네트워크 레이어 우회, 순수 JavaScript 런타임 내 실행
- 기존:
-
파일 수정:
app/api/korea-customs/route.ts- 중복 로직 제거, 동일한 서비스 함수 사용
- 코드 일관성 확보 (DRY 원칙)
기술적 세부사항
- Before: Server → HTTP Request → Localhost API Route → External API
- After: Server → Direct Function Call → External API
- 장점:
- 네트워크 오버헤드 제거
- Vercel 서버리스 환경 호환
- 더 빠른 응답 시간
- 디버깅 용이
📦 커밋 이력
Fix TypeScript build error in MiniChart.tsx and add deployment guideRefactor: Move customs API logic to shared service to fix Vercel localhost fetch error
📄 생성된 문서
deployment_guide.md: Vercel 배포 및 도메인 설정 가이드root_cause_analysis.md: $0 버그 기술 분석 문서
✅ 검증 상태
- ✅ 로컬 빌드 성공
- ✅ GitHub 푸시 완료
- ⏳ Vercel 자동 배포 대기 중 (2-3분 소요 예상)
- ⏳ 프로덕션 데이터 로드 확인 필요
🎯 다음 단계
- Vercel 배포 완료 확인
www.beautyinsightlab.com에서 실제 데이터 표시 확인- 필요시 추가 디버깅 및 최적화
💡 배운 점
- Vercel 서버리스 제약사항: 자기 자신에게 HTTP 요청 불가
- Service Pattern의 중요성: 공통 로직을 독립 함수로 분리하면 재사용성과 테스트 용이성 향상
- 환경별 동작 차이: 로컬과 프로덕션 환경의 네트워크 구성 차이 이해 필요
Beauty Insight Editor
Sharing insights on K-Beauty trends and data-driven export strategies. We help brands expand globally with the power of AI.