fix: return friendly SVG for invalid GitHub username#7956
Conversation
|
@SahilSolve02 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
🚨 Hey @SahilSolve02, the CI Pipeline is failing on this PR and it has been marked as Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run format:check # Check Prettier formatting
npm run lint # Run ESLint
npm run typecheck # TypeScript type check
npm run test # Run unit tests (Vitest)
npm run build # Verify production build passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
6bfdad4 to
be0f4ac
Compare
|
Hey, I took a look at your PR #7956 and the 8 CI failures. The root issue is that your change wraps the fetch logic in a try-catch and returns HTTP 200 with an SVG error card for invalid usernames, but the existing test suite expects specific error status codes — 404 for not-found users, 429 for rate limits, 500 for server errors — along with matching cache headers like no-cache and no-store. When you return 200 instead, all those assertions break. The good news is the codebase already handles this exactly the way the issue describes. If you look at route.ts around lines 841-857, there's already a generateNotFoundSVG() call that returns a friendly SVG error card with a 404 status. The reason it uses 404 and not 200 is intentional — since these SVGs are embedded in READMEs via So the fix is to not change the status codes or cache headers at all. If the SVG error card itself needs a design update (like making it darker or changing the text), that should be done inside generateNotFoundSVG() in lib/svg/generator.ts. I'd also recommend running npx vitest run app/api/streak/route.test.ts locally before pushing — that'll catch these failures immediately. |
Bug Fixed
Fixes #7951 - Invalid GitHub username returned 500 error
Changes
Files Changed
Checklist