I had the same issue on a large website today. I had to go to Vercel - click on the website - settings and then purge the cache. Please note that re-deployment did not fix the issue.
It doesn't matter if the cache is reinvalidated via API, it seems like Prismic is caching something else that gets stuck in the /.next cache, that is related to the master ref.
Any clue what it might be, and why the master ref keeps changing from time to time which breaks things?
the createClient function uses this by default if I don't override the fetchOptions:
{ next: { tags, revalidate: 60 * 60 * 2 } }
Could it be that createClient caches the response from the API endpoint in NextJS, causing it to fetch outdated ref? I went through your troubleshooting article, but it didn't discuss this issue.
I looked into the /.next/cache/fetch-cache folder which has various files made for each request, and each file contains the fetch request made for the page and it includes the master ref in the URL.
If the fetch request for the page is cached, then NextJS should just get the data from cache and make no API call to Prismic (even if the master ref has changed), which is all fine.
So lets say the page is reinvalidated, that file should disappear based on the tag or reinvalidation time, and NextJS should make a new request to fetch the page. I assume it will re-fetch https://perlan.cdn.prismic.io/api/v2 to get a new master ref? If not, then that would be a problem.
I'm trying to figure out why the issue started happening out of the blue, since the website has been running for several months without any issues, and reinvalidation has worked like magic.
Can you provide a full explanation of your data queries and relevant settings? As much information as possible will really help. A link to your project on Github would be perfect.
I had the same issue couple of weeks ago, popped out of the blue for our big website.
I added access token (Access Token - Documentation - Prismic) and upgraded Next to latest and so far it's not happening. And I really really hope it won't.