fix: add /api/stats and /api/og to rate limiting middleware#904
Conversation
|
@KaparthyReddy 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 @KaparthyReddy, welcome to CommitPulse! 🎉 Thanks for opening your first pull request — this is a big deal and we appreciate the effort! While you wait for a review, please double-check:
A maintainer will review your PR shortly. Hang tight! 🚀 |
|
🚨 Hey @KaparthyReddy, 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 |
- Both endpoints call fetchGitHubContributions() on every request - /api/og always bypasses cache, making every call a fresh GitHub API hit - Add /api/stats/:path* and /api/og/:path* to middleware matcher - Consistent with how /api/streak and /api/github are already protected
8323404 to
8a1ed7e
Compare
|
🎉 Congratulations @KaparthyReddy! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Fixes #902
Description
Both
/api/statsand/api/ogendpoints were excluded from the rate limiting middleware matcher, allowing unlimited requests with no throttling./api/ogis especially severe as it always passesbypassCache: true, meaning every call triggers a fresh GitHub API request regardless of volume.This fix adds both routes to the middleware matcher in
middleware.ts, consistent with how/api/streakand/api/githubare already protected.Files changed:
middleware.tsonly — 1 line changed in the matcher array, JSDoc comment updated.Pillar
Visual Preview
N/A — middleware change, no SVG output affected.
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors.README.mdif I added a new theme or URL parameter.