Vercel is serving stale versions of static files, after rebuild #1808
Replies: 11 comments 29 replies
-
Thanks for bringing this to our attention, Magnus. Can you share an example deployment link that we can use to get a better look at what is going wrong? |
Beta Was this translation helpful? Give feedback.
-
@amyegan , thank you for helping me look into this. I created a minimal reproducible example (MRE) with the below details. The problem is still present in the MRE.
On the very first build, the data on the live website is correct. I.e. it represents the latest published data on Contentful. The Error and Steps to Reproduce It
SCREENSHOTS Latest Contentful data. Notice that the Description field is "foo bar", and that the entry is published. I verified that it did redeploy upon publishing, so the webhook works. When navigating to the test-entry page with the page link (Next.js link), the html element holding the Description from Contentful equals "some dataafoobar". That was the Description value two publishes ago. When reloading the browser on the test-entry page, the html element holding the Description from Contentful equals "some daa". That was the previous Description value, before "foo bar". As seen, none of these two show the most recently published Description value, which is foo bar. What I Tried
None of the above fixed the problem. No matter what I tried, Vercel serves the correct version on the first visit after a redeploy, when the As a side note, one or more of the attempts led to Edit:
Further tests:
|
Beta Was this translation helpful? Give feedback.
-
Any input here @amyegan? I am in a bit of a time squeeze and have to move over to Netlify if I cannot get this to work on Vercel. I am pretty sure it is a bug, as the same test on Netlify seems to invalidate and update the cache after redeployment. I would deeply appreciate your input at your earliest convenience. Thanks a million! |
Beta Was this translation helpful? Give feedback.
-
This seems to be related to the App Router and Next.js Cache, which are still in beta at the moment. The engineering team is working on a solution, but they shared a workaround that should get you unstuck for the moment. You can set up a custom incremental cache handler to skip the fetch cache by adding a line to your |
Beta Was this translation helpful? Give feedback.
-
I am having this issue on 13.4.12. |
Beta Was this translation helpful? Give feedback.
-
This is also happening in Nuxtjs, so I'm assuming this is a vercel issue and not framework specific. |
Beta Was this translation helpful? Give feedback.
-
This is still a problem. I am using next 14.1.3. I agree with jastaffen that this should be a vercel issue.
But it still servers the stale pages. |
Beta Was this translation helpful? Give feedback.
-
This is also happening with favicons in 14.1.4. If I delete my icon file, the favicon is gone after deployment. But, if I create a new file with the same name and deploy again, the old file that was deleted will re-appear. There doesn't seem to be a way to remove these old static files from the build. |
Beta Was this translation helpful? Give feedback.
-
Hope this helps some people: I am using Nuxt.js on Vercel (not important to the final cause), and I was having this exact same issue:
The issue for me was that at some point in the previous week, I had created a Local Override in Chrome DevTools. I finally noticed this was distinguishable by the small purple circle on the bottom right of the document icon in the Network tab of Chrome DevTools: Another way to spot this behaviour via the Chrome DevTools Network log, on initial page load, my document was correctly compressed to 90kB using brotli (a default, via Vercel). The problematic document on refresh was showing as 680kB - aka not being compressed, and not being served via Vercel. This Local Override had stored the old HTML file and content as a file on my computer and was serving it to my browser under the circumstances mentioned above. Finding and deleting this Local Override solved my issue. FYI - Local Overrides can be created for everything in the Network log: HTML Documents, fetch/API responses, CSS files, etc. so worth checking for that purple circle! |
Beta Was this translation helpful? Give feedback.
-
exactly the same issue, I can not update the |
Beta Was this translation helpful? Give feedback.
-
I also have the same issue |
Beta Was this translation helpful? Give feedback.
-
Summary
I have come across a seemingly significant issue with the Vercel cache.
Background
Problem
SCREEN SHOTS
Build output:
HTTP Request and Response, on the first page visit after redeploying:
HTTP Request and Response on subsequent visits to the site:
Observations and Question
As seen from the
x-vercel-cache
header, Vercel does indeed grab the new (non-stale) files from the static build when a client first visits the page after redeploying (definition of PRERENDER here).On subsequent visits, however, it shows stale / old data. That data was served from the Vercel cache (HIT in the
x-vercel-cache
header). For some bizarre reason, it does not look like the Vercel cache was updated with the latest files from the static build, during the first visit.Any idea what is going on here, and how to fix it?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions