Skip to content

fix(guides): build OG images for all 504 posts (was 39)#2436

Merged
andrew-bierman merged 2 commits into
developmentfrom
fix/og-images-build-order
May 17, 2026
Merged

fix(guides): build OG images for all 504 posts (was 39)#2436
andrew-bierman merged 2 commits into
developmentfrom
fix/og-images-build-order

Conversation

@andrew-bierman
Copy link
Copy Markdown
Collaborator

The bug

apps/guides/package.json build script ran in the wrong order:

"build": "bun run generate-og-images && bun run build-content && next build"

generate-og-images runs first and reads lib/content.ts. But lib/content.ts is itself written by build-content from content/posts/*.mdx. So OG generation saw the stale committed version of lib/content.ts (39 posts) instead of the freshly-built 504-post list.

Visible in the CF Pages build log:

  • Build content: Built 504 posts and 29 categories
  • OG generation: Done — generated 1 root + 39 post OG images

465 of 504 guides shipped without OG/Twitter images.

The fix

One-line swap: run build-content first, then generate-og-images, then next build.

- "build": "bun run generate-og-images && bun run build-content && next build"
+ "build": "bun run build-content && bun run generate-og-images && next build"

Verified locally

Built 504 posts and 29 categories
Done — generated 1 root + 504 post OG images.

Follow-up

A hardening PR will follow with:

  • Test asserting generate-og-images count matches build-content post count
  • GH Actions workflow that builds guides + landing on every PR (so we get build signal without relying on CF Pages)
  • Lighthouse CI guardrails

…posts

The build script ran 'generate-og-images' BEFORE 'build-content', so OG generation read the stale committed lib/content.ts (39 posts) instead of the freshly-built 504-post list.

Result: only 39 of 504 guides had OG/Twitter images on the deployed site.

Fix: run build-content first to regenerate lib/content.ts, then generate-og-images reads the up-to-date 504 posts.

Verified locally:
  Built 504 posts and 29 categories
  Done — generated 1 root + 504 post OG images.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 05:51
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Warning

Rate limit exceeded

@andrew-bierman has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 55 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 362bfd09-9240-4443-80f3-810910f1c817

📥 Commits

Reviewing files that changed from the base of the PR and between e5a8f95 and 2004ddc.

📒 Files selected for processing (2)
  • apps/guides/__tests__/og-image.test.ts
  • apps/guides/package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/og-images-build-order

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file web labels May 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Guides app build pipeline so OG image generation runs against the freshly generated lib/content.ts (reflecting all posts) rather than the stale committed version, ensuring every guide gets an OG/Twitter image in static exports.

Changes:

  • Reorders apps/guides build script to run build-content before generate-og-images.
  • Ensures generate-og-images reads the up-to-date posts list via lib/mdx-staticlib/content.ts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link
Copy Markdown
Contributor

cloudflare-workers-and-pages Bot commented May 17, 2026

Deploying packrat-guides with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2004ddc
Status:🚫  Build failed.

View logs

Default vitest hook timeout is 5s; generating per-post PNGs takes 30-60s for the full set, so the beforeAll() that runs generate-og-images.ts was killed mid-run. Raising to 180s.

Bundled with the build-order fix in this PR because the test only becomes meaningful once the build runs in the right order — with the prior order, the test still passed on the stale 39-post snapshot, masking the real bug.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@andrew-bierman andrew-bierman merged commit 47f3786 into development May 17, 2026
9 of 10 checks passed
@andrew-bierman andrew-bierman deleted the fix/og-images-build-order branch May 17, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants