Skip to content

fix: GitHub 공식 GraphQL API로 컨트리뷰션 조회 전환 - #4

Merged
anonymousRecords merged 2 commits into
mainfrom
fix/official-github-contributions-api
Aug 29, 2026
Merged

fix: GitHub 공식 GraphQL API로 컨트리뷰션 조회 전환#4
anonymousRecords merged 2 commits into
mainfrom
fix/official-github-contributions-api

Conversation

@anonymousRecords

Copy link
Copy Markdown
Owner

변경 사항

/api/[username]/animation 요청이 사용자·테마 관계없이 100% 500으로 실패하던 문제를 수정했습니다.

원인: 컨트리뷰션 데이터를 가져오던 github-contributions-api.deno.dev가 Deno Deploy Classic 서비스 종료(2026-07-20)로 사라졌습니다.

$ curl https://github-contributions-api.deno.dev/anonymousRecords.json
404: Not Found (DEPLOYMENT_NOT_FOUND)
Deno Deploy Classic was sunset on July 20, 2026 and no longer serves deployments.

fetchContributions가 404에서 throw하고, route.ts의 catch가 이를 500으로 변환하는 구조라 flower/hair 두 테마 모두 우회 경로가 없었습니다.

해결: GitHub 공식 GraphQL API를 직접 호출하도록 교체했습니다. 사라진 API는 GitHub의 contributionCalendar 응답을 그대로 중계하던 것이라 (contributionCount, contributionLevel: NONE | FIRST_QUARTILE... 등 필드명이 GitHub GraphQL 스키마와 동일) 응답 파싱 로직과 chunkIntoWeeks는 변경 없이 요청 경로만 바꾸면 됐습니다.

부수적으로 GraphQL errors 배열과 user: null을 구분해 처리하여, 실패 시 원인이 서버 로그에 드러나도록 했습니다. (기존에는 Failed to fetch contributions for X 한 줄이 전부)

⚠️ 배포 전 필수: Vercel 환경변수에 GITHUB_TOKEN 등록 필요 (read:user 스코프). 등록 완료된 상태입니다.

변경 유형

  • 버그 수정 (기존 기능을 수정하는 non-breaking change)
  • 새 기능 (기존 기능을 유지하면서 추가되는 non-breaking change)
  • Breaking change (기존 기능에 영향을 주는 변경)
  • 문서 업데이트

관련 이슈

없음

테스트 방법

테스트 프레임워크가 없어 실제 함수를 호출하는 검증 스크립트로 확인했습니다. 수정 전 실패를 먼저 확인한 뒤 수정했습니다.

수정 전:  FAIL: Failed to fetch contributions for anonymousRecords
수정 후:  PASS: 371 days, 53 weeks, 1628 total contributions

로컬 dev 서버 엔드투엔드:

요청 결과
?theme=flower&quality=low 200, image/png 431KB, 782x180 APNG (잔디 데이터 정상 렌더)
?theme=hair&quality=low&curliness=curly 200, image/png 114KB
존재하지 않는 유저 500 (기존과 동일) — 단, 서버 로그에 Could not resolve to a User with the login of '...' 출력

존재하지 않는 유저에 404를 반환하는 개선은 이번 수정 범위에서 제외했습니다. route.ts의 에러 처리 구조 변경이 필요해 별도 PR이 적절합니다.

체크리스트

  • 코드가 프로젝트 스타일 가이드를 따름
  • 셀프 코드 리뷰 완료
  • 필요한 경우 문서 업데이트
  • pnpm lint 통과 (48개 파일)
  • pnpm build 통과 (exit 0)

스크린샷 (UI 변경 시)

변경 전 변경 후
500 Internal Server Error 782x180 APNG 정상 생성 (1628 커밋 렌더)

🤖 Generated with Claude Code

https://claude.ai/code/session_01La1oXcrwEZycnLJGdkFn3y

기존에 사용하던 github-contributions-api.deno.dev가 Deno Deploy Classic
서비스 종료(2026-07-20)로 사라지면서 모든 애니메이션 요청이 500으로 실패했다.

해당 API는 GitHub GraphQL의 contributionCalendar 응답을 그대로 중계하던
것이라, 공식 API를 직접 호출해도 데이터 구조는 동일하다. 따라서 응답
파싱 로직과 chunkIntoWeeks는 그대로 두고 요청 경로만 교체했다.

- GITHUB_TOKEN 환경변수로 api.github.com/graphql 인증 호출
- GraphQL errors 배열과 user null을 구분해 처리하여 실패 원인이
  서버 로그에 드러나도록 개선

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01La1oXcrwEZycnLJGdkFn3y
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
git-style Ready Ready Preview Aug 29, 2026 8:33am

@anonymousRecords
anonymousRecords merged commit a7510b4 into main Aug 29, 2026
3 checks passed
@anonymousRecords
anonymousRecords deleted the fix/official-github-contributions-api branch August 29, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant