Skip to content

[fix] production 클라이언트 Sentry 500 에러 캡처 확인 #253

Description

@haesol2022

📄 Description

PR #227에서 enabled: process.env.VERCEL_ENV === "production" 조건을 추가했으나, instrumentation-client.ts는 클라이언트 사이드 파일이기 때문에 NEXT_PUBLIC_ 접두사 없이는 VERCEL_ENV 환경변수를 읽을 수 없음.

결과적으로 클라이언트 사이드 Sentry가 production에서도 항상 비활성화 상태로 동작하고 있는 것으로 추정되며, 500 에러가 Discord에 알림으로 오지 않은 원인인지 확인해볼 필요가 있음

✅ Tasks

  • instrumentation-client.ts의 enabled 조건 수정
    • process.env.VERCEL_ENVprocess.env.NEXT_PUBLIC_VERCEL_ENV
  • Vercel 대시보드에서 환경변수 추가
    • Name: NEXT_PUBLIC_VERCEL_ENV
    • Value: production
    • Environment: Production만 체크
  • 500 에러 테스트용 라우트 추가 후 production에서 Sentry → Discord 알림 확인
    • apps/web/src/app/api/test-error/route.ts 추가하여 dev 머지
    • production URL /api/test-error 호출 후 알림 수신 확인
    • 확인 후 해당 파일 삭제 PR 올리기

📎 ETC

원인 분석

  • sentry.server.config.ts, sentry.edge.config.ts: 서버사이드 -> VERCEL_ENV 정상 동작
  • instrumentation-client.ts: 클라이언트사이드 -> NEXT_PUBLIC_ 없으면 항상 undefined

참고

  • NEXT_PUBLIC_VERCEL_ENV는 Vercel이 자동 주입하지 않으므로 대시보드에서 직접 추가 필요
  • Sentry Test Notification은 정상 동작 확인됨 (웹훅 수신 로직은 이상 없음)

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions