Skip to content

fix(redirects): remove trailing-slash duplicates to fix build OOM#255

Merged
erinmikailstaples merged 2 commits into
mainfrom
fix-stainless-check
May 7, 2026
Merged

fix(redirects): remove trailing-slash duplicates to fix build OOM#255
erinmikailstaples merged 2 commits into
mainfrom
fix-stainless-check

Conversation

@erinmikailstaples
Copy link
Copy Markdown
Collaborator

@erinmikailstaples erinmikailstaples commented May 6, 2026

Describe your changes

The Stainless Docs Build CI check has been failing on every PR with FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory. Root cause: Astro was registering 50+ routes twice (once as /foo and once as /foo/) due to redirect entries that defined both source-key forms. With astro trailingSlash: "never", both forms normalize to the same canonical route and collide — doubling build work and pushing Node's heap past the 2GB limit.

Vercel already strips trailing slashes from incoming URLs at the platform level (vercel.json trailingSlash: false), so the trailing-slash source keys were never actually firing in production — they were dead config that was triggering the route-collision warnings (which Astro will turn into a hard error in a future release).

What I changed: Removed all 52 trailing-slash source keys from the redirects block in astro.config.ts. Added a short comment explaining the convention (no-trailing-slash sources only).

User-visible behavior is unchanged: Vercel normalizes /foo//foo before redirect rules apply, then the no-slash entry fires. Six entries had different destinations between their no-slash and trailing-slash forms (e.g. /learn/data-management/data-retention vs /learn/data-management/data-retention/) — those trailing-slash destinations were already dead in production due to Vercel's normalization, so removing them aligns config with actual behavior.

Build verification (DOCS_LOCAL_WITHOUT_STAINLESS=1 pnpm build):

Before After
Build time ~138s → OOM at 2GB heap 46s
Pages built (failed) 692
Route-collision warnings 100+ 0

Follow-up worth tracking separately (not part of this PR): Two unrelated route conflicts surfaced in the build log where a real MDX file is shadowed by a redirect targeting its own path:

  • /learn/continuous-aggregates/about-continuous-aggregates
  • /learn/data-management/data-lifecycle

Either the redirect or the MDX should go in each case.

Affected pages

No content pages affected by this PR. Open the preview to confirm the build deployed successfully.

Related Issues

Issue: #number

Checklist before requesting a review

  • - This is ready for review. If not, raise as a draft PR
  • - I have reviewed my changes.
  • - I have confirmed the content is technically accurate.
  • - I have tested any code that is added or updated on the latest available version.
  • - I have confirmed the content is free of typos or grammar errors.
  • - I have verified all images and videos are clear and match production (or dev for unreleased features).
  • - This references a feature that is public. If not, add a note and we can schedule the merge for after the feature release.

The Stainless Docs Build CI check was failing with "Ineffective
mark-compacts near heap limit" because Astro was registering 50+ routes
twice (once as /foo and once as /foo/) due to redirect entries that
defined both source-key forms. With astro `trailingSlash: "never"`,
both forms normalize to the same canonical route and collide.

Vercel already strips trailing slashes from incoming URLs at the
platform level (vercel.json `trailingSlash: false`), so the
trailing-slash source keys were never actually firing in production
anyway -- they were dead config that doubled build work and triggered
the route-collision warnings ("A collision will result in a hard error
in following versions of Astro").

Removed all 52 trailing-slash source keys. User-visible behavior is
unchanged: Vercel normalizes /foo/ -> /foo before redirect rules apply,
then the no-slash entry fires.

Six entries had different destinations between their no-slash and
trailing-slash forms (e.g. /learn/data-management/data-retention vs
/learn/data-management/data-retention/) -- those trailing-slash
destinations were already dead in production due to Vercel's
normalization, so removing them aligns config with actual behavior.

Verified locally with DOCS_LOCAL_WITHOUT_STAINLESS=1 pnpm build:
- Before: ~138s, OOM at 2GB heap
- After:  46s, 692 pages built cleanly
- Route-collision warnings: 100+ -> 0
@erinmikailstaples erinmikailstaples requested a review from a team May 6, 2026 20:51
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

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

Project Deployment Actions Updated (UTC)
tiger-data-docs Ready Ready Preview, Comment May 7, 2026 1:29pm

Request Review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

✅ Checklist Complete

Thank you for taking the time to properly review your PR! All checklist items are complete.

@erinmikailstaples erinmikailstaples merged commit 5251355 into main May 7, 2026
1 of 3 checks passed
@erinmikailstaples erinmikailstaples deleted the fix-stainless-check branch May 7, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants