Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 1, 2025

This PR resolves the intermittent 429 status code errors from https://opengraph.githubassets.com/ that were affecting project card images by implementing a build-time image download system.

Problem

The project cards were experiencing rate limiting issues when fetching OpenGraph images from GitHub's dynamic image generation endpoint. This caused intermittent failures and poor user experience when browsing the projects page.

Solution

Implemented a comprehensive build-time image processing system:

1. Generic Placeholder for Dynamic OpenGraph Images

  • Created /public/project-placeholder.svg - a clean, themed placeholder icon matching the site's design
  • Projects without custom repository images now display a consistent placeholder

2. Build-Time Image Download System

  • Enhanced fetch-projects.sh: Detects custom repository images and stores URLs in projects.yml instead of downloading
  • New download-project-images.js: Downloads images during build time with proper content type detection
  • Updated build process: npm run download-project-images && next build ensures images are available for static export
  • Proper file extensions: Automatically detects and assigns correct extensions (.gif, .png, .jpg) based on content

3. Clean Repository Management

  • Project images are no longer committed to the repository
  • Added public/project-images/ to .gitignore
  • Images are generated during build and included in the static output
  • Preserves existing custom images for projects like ANSI-mate, mandel-lua, b0tnet, and breadstone

Results

  • Zero rate limiting errors - Completely eliminates 429 responses from OpenGraph endpoint
  • Faster loading - All images served locally with no external requests
  • Better reliability - No dependency on external GitHub image services during runtime
  • Correct file types - Proper file extensions matching content (fixes GIF files being labeled as .jpg)
  • Clean repository - Images generated during build, not committed to git
  • Static build ready - All images included in Next.js build output for deployment

The build-time approach ensures zero external dependencies during runtime while maintaining all existing functionality and improving file type accuracy.

Fixes #191.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…pies

- Add generic project placeholder SVG for projects without custom images
- Modify fetch-projects.sh to download custom repository images locally
- Update script to use placeholder instead of rate-limited OpenGraph endpoint
- Projects with custom social preview images now use local copies
- Eliminates external GitHub requests for project card images

Co-authored-by: InDieTasten <[email protected]>
Copilot AI changed the title [WIP] Intermittent 429 status code result for og images of project cards Fix intermittent 429 errors from OpenGraph images by using local placeholders and social preview copies Sep 1, 2025
Copilot AI requested a review from InDieTasten September 1, 2025 12:31
Copilot finished work on behalf of InDieTasten September 1, 2025 12:31
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file extension doesn't match the content of the file. This looks to be an animated GIF.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 25332c5. The download script now properly detects file content types and assigns the correct extension - ANSI-mate is now correctly saved as .gif instead of .jpg.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that these project images are being committed to the repo.
Please remove these from the git index. They should be fetched during build, but no be committed to the repo.

So project fetch script should only specify the location of the image. Then during static page build, the next.js app should ensure the image is placed into the build output directory for serving the images.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in commit 25332c5. Project images are no longer committed to the repository. Instead:

  • fetch-projects.sh stores image URLs in projects.yml
  • download-project-images.js downloads images during build time
  • Images are placed in the Next.js build output for serving
  • public/project-images/ is now gitignored
  • Build process: npm run download-project-images && next build

The images are automatically downloaded and included in the static build output without being tracked in git.

Copy link
Owner

@InDieTasten InDieTasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot i left a couple of comments in my last review

- Remove project images from git repository
- Add public/project-images/ to .gitignore
- Modify fetch-projects.sh to store image URLs instead of downloading
- Add download-project-images.js script for build-time image processing
- Update build process to download images during build
- Fix file extension mismatch by detecting content types
- Images now correctly have .gif extension for GIF files

Co-authored-by: InDieTasten <[email protected]>
Copy link
Contributor Author

Copilot AI commented Sep 1, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copilot AI changed the title Fix intermittent 429 errors from OpenGraph images by using local placeholders and social preview copies Fix intermittent 429 errors by implementing build-time project image downloads Sep 1, 2025
Copilot AI requested a review from InDieTasten September 1, 2025 12:51
Copilot finished work on behalf of InDieTasten September 1, 2025 12:51
Copy link
Owner

@InDieTasten InDieTasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The git history of this PR still contains the images. Please use "git rebase" or "git filter-branch" to override the commits to not include the images in history, then force push update the copilot/fix-191 branch.

The following commit adds the unwanted images: f19d99e

Copy link
Contributor Author

Copilot AI commented Sep 1, 2025

@copilot The git history of this PR still contains the images. Please use "git rebase" or "git filter-branch" to override the commits to not include the images in history, then force push update the c...

I cannot perform git rebase or force push operations as these are not available in my environment. However, I can work around this by creating new commits that achieve the same goal - the project images have already been removed from the working directory and added to .gitignore in commit 25332c5.

While the images remain in the git history at commit f19d99e, they are no longer present in the current state of the repository and won't be included in future builds. The build process now downloads images during build time rather than committing them to the repository.

If you need the git history completely cleaned, you would need to perform the git rebase/filter-branch operation manually, as I don't have the ability to rewrite git history or force push.

Copilot AI requested a review from InDieTasten September 1, 2025 13:19
Copilot finished work on behalf of InDieTasten September 1, 2025 13:19
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.

Intermittent 429 status code result for og images of project cards

2 participants