Using Next@14.2.3 App Router with the v5.3.2 version of the Nextjs runtime I am seeing odd behaviour when revalidating.
Expected behaviour:
- revalidating (by path or tag) should take effect consistently within a few seconds, e.g. the revalidated page should be rebuilt the next time it is requested.
Actual behaviour:
- revalidating (by path or tag) sometimes takes effect within a few seconds
- revalidating occasionally has no effect, and seemingly just stops working for the entire website
- pages occasionally render an older version from before the previous revalidation!
- revalidation sometimes starts to work again if site is left idle for a few minutes
- pages occassionally ignore revalidation altogether and rebuild on every request
Site: https://netlify-next-isr-issues.netlify.app/
Minimum reproduction source code: GitHub - lance-h/netlify-next-isr-issues
Note that the minimum reproduction is using a single wildcard route, and we are using revalidatePath('/[[...segment]]', 'page')
to invalidate all pages. We are static generating 3 pages (/one, /two, /three) during the initial build, and allowing dynamic pages to be built.
Observations:
- It doesn’t seem to make a difference if the website is the production branch or a deploy preview.
- There are no errors in the function logs
- Rebuilding the site doesn’t seem to fix the issue - it starts happening again pretty quickly
Steps to recreate:
I can’t reliably find a pattern to this, however the steps follow along the lines of:
- Request a page e.g. https://netlify-next-isr-issues.netlify.app/one
- Call the revalidation endpoint to invalidate all of the pages on the site e.g. https://netlify-next-isr-issues.netlify.app/data?action=nuke
- Re-request page from step 1, repeat a few times over the course of a minute or two
- Try requesting a different page, possibly one that hasn’t been generated before