Skip to content

fix: revalidate blog 404s instead of pinning them for a year - #385

Draft
josephfusco wants to merge 1 commit into
mainfrom
fix/blog-404-revalidate
Draft

fix: revalidate blog 404s instead of pinning them for a year#385
josephfusco wants to merge 1 commit into
mainfrom
fix/blog-404-revalidate

Conversation

@josephfusco

Copy link
Copy Markdown
Member

getStaticProps cannot distinguish a deleted post from a failed query, since both return empty. Without revalidate, Next pins s-maxage=31536000 on the resulting 404, so a momentary upstream failure takes a live post offline for a year.

The #383 preview deploy hit exactly this: four of six posts still 404 at the edge despite rendering correctly at the source, because they were requested during the window before the persisted query registered.

Adding revalidate to the 404 branch does not prevent a bad 404, it caps it at five minutes.

AI usage

Model(s): claude-opus-5
Used for: Root cause investigation, drafting, and implementation

An empty query response is indistinguishable from a genuinely missing
post, so returning notFound without revalidate lets Next cache a
transient upstream failure at s-maxage=31536000.
@headless-platform-by-wp-engine

Copy link
Copy Markdown

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-fix/blog-404-revalidate https://h1…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

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