Skip to content

fix(api): do not cache error SVG responses on CDN#641

Open
eshaanag wants to merge 1 commit into
JhaSourav07:mainfrom
eshaanag:fix/error-svg-cache-control
Open

fix(api): do not cache error SVG responses on CDN#641
eshaanag wants to merge 1 commit into
JhaSourav07:mainfrom
eshaanag:fix/error-svg-cache-control

Conversation

@eshaanag
Copy link
Copy Markdown

Description

Fixes #622

Pillar

  • 🛠️ Other (Bug fix, refactoring, docs)

What changed

The catch-all error handler in app/api/streak/route.ts:175 was returning error SVG responses with Cache-Control: public, s-maxage=60. This allowed CDNs to cache broken error badges for up to 60 seconds, meaning users embedding the badge in a README would continue seeing the error SVG even after the backend or GitHub had fully recovered.

Changed the Cache-Control header on error responses to no-store so CDNs never cache transient failures. Success responses are unaffected.

Visual Preview

N/A — this is a response header change only.

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors.
  • My commits follow the Conventional Commits format (e.g., fix(api): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have starred the repo.
  • I have made sure that I have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse quality standard.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 27, 2026

Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

👋 Hey @eshaanag, 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:

  • ✅ You've read the CONTRIBUTING.md checklist
  • npm run lint, npm run format, and npm run test all pass locally
  • ✅ Your PR has a visual preview if it touches any SVG output
  • 💬 You've joined our Discord for faster PR feedback

A maintainer will review your PR shortly. Hang tight! 🚀

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label May 27, 2026
@github-actions
Copy link
Copy Markdown

🚨 Hey @eshaanag, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

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 passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@eshaanag eshaanag force-pushed the fix/error-svg-cache-control branch from 1a1ffa0 to 7e41e82 Compare May 27, 2026 16:29
@github-actions github-actions Bot added needs-rebase This PR has merge conflicts and needs a rebase. and removed status:blocked This PR is blocked due to a failing CI check. labels May 27, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Hey @eshaanag, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

@github-actions github-actions Bot added the type:bug Something isn't working as expected label May 27, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Hey @eshaanag, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

@eshaanag eshaanag force-pushed the fix/error-svg-cache-control branch from 7e41e82 to e2a03dc Compare May 27, 2026 18:41
@eshaanag
Copy link
Copy Markdown
Author

Hi @maintainer, this PR was raised as part of GSSoC 2026 contribution.
Could you please add the appropriate GSSoC label if applicable? Thanks!

@github-actions github-actions Bot removed the needs-rebase This PR has merge conflicts and needs a rebase. label May 27, 2026
@eshaanag
Copy link
Copy Markdown
Author

Hi maintainers, quick status update: the required GitHub Actions checks are passing and this PR is approved. The only remaining failing check is Vercel authorization, which seems to need maintainer approval from the project team. Could you please authorize/merge when convenient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Error SVG responses should not be cached by CDN

2 participants