Skip to content

fix(og): read the home OG font from disk instead of fetching it at build time - #71

Open
santifer wants to merge 1 commit into
mainfrom
fix/og-font-offline
Open

fix(og): read the home OG font from disk instead of fetching it at build time#71
santifer wants to merge 1 commit into
mainfrom
fix/og-font-offline

Conversation

@santifer

@santifer santifer commented Sep 10, 2026

Copy link
Copy Markdown
Member

Found while checking whether Vercel had a problem. Production is healthy; this is a build reliability fix.

What happened

The 7 September deployment failed:

Error occurred prerendering page "/opengraph-image-12gd74"
[TypeError: fetch failed] { [cause]: AggregateError: ... code: 'ETIMEDOUT' }
Export encountered an error on /(home)/opengraph-image-12gd74/route, exiting the build.

The home OG route fetched its font from fonts.gstatic.com at build time. Every deployment therefore depended on Google being reachable at that exact moment, and a route whose only job is to render one static image could bring the whole build down.

It happened on a preview this time. Nothing about it is preview-specific.

The fix already existed in this repo

src/app/manifesto/s/[username]/opengraph-image.tsx vendors its font on disk and says why in a comment. This applies the same pattern to the home route.

The image does not change

Verified rather than assumed: the OG rendered from this build is byte-identical to what production serves today.

Local (this branch) 651,455 bytes
career-ops.org/opengraph-image-12gd74 651,455 bytes
SHA-256 identical

The vendored file is the exact bytes that URL served (62,284). Worth noting it is not the same file the manifesto route vendors, which is a different cut of the same family at 69,312 bytes, so they stay separate rather than being shared.

The part that is easy to miss

The font path is added to outputFileTracingIncludes. Without it the build would go green and the route would 500 at runtime instead, which is the worse of the two failures: a broken OG image is invisible until someone shares a link.

Verification

  • tsc --noEmit clean, production build clean
  • OG route serves 200 with image/png from a fresh build
  • Byte-for-byte match against production confirmed by SHA-256

🤖 Generated with Claude Code

https://claude.ai/code/session_01BcPLgMFMs2B4SJv3vfq8jv

Summary by CodeRabbit

  • Bug Fixes
    • Improved home page social sharing image generation by ensuring its typography loads reliably from bundled local font files.
    • Reduced reliance on external font fetching when creating Open Graph images.

…ild time

The 7 September build failed with ETIMEDOUT while prerendering
/opengraph-image, and the whole deployment exited with it. The route was
fetching its font from fonts.gstatic.com, so every build depended on a third
party being reachable at that instant, and a route that renders one static
image could take the deployment down. It happened on a preview; nothing stops
it happening on a production deploy.

The sibling route under manifesto/s/[username] already vendors its font on
disk, with a comment explaining why. This applies the same pattern to the
home route.

The vendored file is the exact bytes that URL served, so the image is
unchanged: the render from this build is byte-identical to the one production
serves today, 651,455 bytes, same SHA-256. Note it is NOT the same file the
manifesto route vendors, which is a different cut of the same family at 69,312
bytes, so the two are kept separate rather than shared.

The path is added to outputFileTracingIncludes. Without that the build would
stay green and the route would fail at runtime instead, which is the worse
failure of the two.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BcPLgMFMs2B4SJv3vfq8jv
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
career-ops-docs Ready Ready Preview Sep 10, 2026 8:44pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d0a86dce-cd33-4f69-a1ba-651e9692eb13

📥 Commits

Reviewing files that changed from the base of the PR and between c4a2413 and afadc9f.

⛔ Files ignored due to path filters (1)
  • src/app/(home)/InstrumentSerif-Regular.ttf is excluded by !**/*.ttf
📒 Files selected for processing (2)
  • next.config.mjs
  • src/app/(home)/opengraph-image.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The home Open Graph route now reads Instrument Serif from a local TTF file. Next.js configuration includes the font file in the route’s traced deployment bundle.

Changes

Open Graph font loading

Layer / File(s) Summary
Bundle and load the local font
src/app/(home)/opengraph-image.tsx, next.config.mjs
The route reads the local font file and converts it for ImageResponse. Next.js traces the TTF file into the /opengraph-image bundle.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to afadc

The home OG route now uses a bundled font, avoiding build-time third-party network failures. Reported build and route checks show no merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: the home OG font now loads from disk instead of being fetched during the build.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/og-font-offline

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.

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.

1 participant