If Next ISR fails on second revalidation, does it serve the previous generated content?

Hi all,

My understanding of ISR in Next.js is: If ISR fails on second revalidation (for example: external API is down), it will fallback to the previously successful generated content from the first revalidation.

Does that currently work with Next.js on Netlify?

Thanks very much.

Hey @sevfurneaux,

Yes, Netlify uses Stale While Revalidate (SWR). So it will continue to serve the previous content as long as the fresh one is not available.

Thanks @hrishikesh! Has Netlify now added stale-while-revalidate?

I understood that they disallowed this: fix: ensure stale-while-revalidate headers are not sent by ascorbic · Pull Request #737 · netlify/next-runtime · GitHub

The readme offers better description that that PR :wink: (this document is linked in the top-readme):

Thanks for the info.

Does that mean On Demand Builders will continue to serve stale content once the TTL has expired if there is an error on regeneraiton?

Yes, as long as the page generation is not successful, the cached copy will be served.

Great, thanks for the info @hrishikesh!