Sentry 에러를 Google Gemini AI가 자동으로 분석해서 GitHub Issue로 만드는 시스템
[Sentry 에러 발생]
↓
[Sentry Webhook]
↓
[Vercel Function] ← 이 저장소
↓
[GitHub Actions 트리거]
↓
[Gemini AI 분석 + Issue 생성]
Sentry Webhook을 받아서 GitHub Actions를 트리거하는 중계 서버
- Vercel에 로그인
- "New Project" 클릭
- 이 GitHub 저장소 (
sentry-analyzer) 선택 - 배포 (Deploy)
Vercel 프로젝트 설정에서 다음 환경변수 추가:
| 변수명 | 설명 | 예시 |
|---|---|---|
GITHUB_TOKEN |
GitHub Personal Access Token | ghp_xxxxxxxxxxxx |
GITHUB_OWNER |
GitHub 사용자명/조직명 | userjmmm |
GITHUB_REPO |
GitHub 저장소명 | inplace |
- GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
- "Generate new token (classic)" 클릭
- 권한 선택:
repo(전체) - repository_dispatch를 위해 필요
- 토큰 생성 후 복사
배포 완료 후 URL 확인:
https://your-project.vercel.app/api/sentry-webhook
- Sentry > Settings > Developer Settings > Internal Integrations
- "New Internal Integration" 클릭
- 설정:
- Name: GitHub Issue Creator
- Webhook URL:
https://your-project.vercel.app/api/sentry-webhook - Webhooks:
error.created,issue.created체크 - Permissions: 필요 없음 (읽기만 함)
- Sentry > Alerts > Create Alert
- 조건 설정:
- "When an event is first seen"
- 또는 "When an error occurs"
- Actions:
- "Send a webhook" 선택
- 위에서 만든 Integration 선택
npm install
npm run devcurl -X POST https://your-project.vercel.app/api/sentry-webhook \
-H "Content-Type: application/json" \
-d '{
"action": "created",
"data": {
"issue": {
"id": "123456",
"title": "Test Error",
"culprit": "test.js",
"level": "error",
"project": {"slug": "test-project"},
"permalink": "https://sentry.io/issues/123456"
}
}
}'이 저장소 설정이 완료되면:
- inplace 저장소에 GitHub Actions Workflow 추가
- inplace 저장소에 Gemini AI 분석 스크립트 추가
- GitHub Secrets 설정:
GEMINI_API_KEY: Google Gemini API 키SENTRY_AUTH_TOKEN: Sentry API 토큰SENTRY_ORG: Sentry 조직 slug
sentry-analyzer/
├── api/
│ └── sentry-webhook.js # Vercel Serverless Function
├── package.json
├── vercel.json # Vercel 설정
├── .gitignore
└── README.md
- Vercel 로그 확인: Vercel Dashboard > Deployments > Functions
- Sentry Integration 확인: Sentry > Settings > Integrations
- GitHub Token 권한 확인:
repo권한 필요
- GitHub 저장소 설정 확인: Settings > Actions (활성화 필요)
- Workflow 파일 확인:
.github/workflows/sentry-analysis.yml존재 여부 - repository_dispatch 이벤트 확인
MIT