Skip to content

fix(docs): pre-render default locale only to fix Vercel build OOM#684

Closed
berry-13 wants to merge 2 commits into
mainfrom
fix/docs-build-oom
Closed

fix(docs): pre-render default locale only to fix Vercel build OOM#684
berry-13 wants to merge 2 commits into
mainfrom
fix/docs-build-oom

Conversation

@berry-13

Copy link
Copy Markdown
Member

Problem

Production builds on main fail since #683 (publishing 8 new locales). The app/[lang]/docs/[[...slug]] route pre-renders one page per (locale, doc), which jumped from ~1,080 to ~2,340 pages and exhausts the 8 GB Vercel build runner: sometimes a heap OOM at 10-15 min, sometimes the 45-minute build timeout. The site stays up on the last good deployment (#682), but the translations can't ship.

Fix

  • Pre-render the default language only. generateStaticParams now returns just the default locale (~180 pages). Localized docs render on demand (dynamicParams is the default, now explicit) and edge-cache on first hit via the existing cdnCacheHeaders. Build cost stays flat regardless of how many languages exist. Behaviour is otherwise unchanged: an untranslated locale still redirects to English in Page(), and hreflang/canonical gating is untouched.
  • Heap headroom. build runs with --max-old-space-size=7168 via cross-env as a safety net for the webpack compile phase.

Verification

The Vercel preview build for this PR is the test: if it goes green, the OOM is resolved. After merge, sanity-check that a localized page (e.g. /de/docs/...) renders on demand.

If the preview still OOMs

That would mean the limit is the webpack compile phase (compiling all MDX modules), which this PR does not reduce. In that case bump the Vercel build machine to a larger tier and raise the 7168 cap to match.

… OOM

Publishing all 13 locales (#683) grew the [lang]/docs/[[...slug]] route from ~1,080 to ~2,340 pre-rendered pages, which exhausted the 8 GB Vercel build runner (OOM around 10-15 min, or the 45-minute build timeout). Pre-render the default language only and let localized docs render on demand (dynamicParams, already the default) and edge-cache on first hit, so build cost stays flat as more languages are added. An untranslated locale still redirects to English in Page(); hreflang/canonical gating is unchanged. Also add a NODE_OPTIONS heap-headroom flag as a safety net for the webpack compile phase.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
librechat-ai Error Error Jun 29, 2026 1:33am

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eea5dddb55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/[lang]/docs/[[...slug]]/page.tsx
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Localized docs render on demand, so they aren't in the build output next-sitemap scans and dropped out of sitemap.xml while generateMetadata still advertises hreflang alternates to them. Enumerate the translated files (content/docs/<path>.<locale>.mdx) and add their URLs back via additionalPaths, at the same priority as English docs.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for librechat.ai

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@berry-13 berry-13 closed this Jun 29, 2026
@berry-13
berry-13 deleted the fix/docs-build-oom branch June 29, 2026 13:20
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