Next.js Discord

Discord Forum

Revalidate not work in production after time (on Vercel or vps)

Unanswered
kkkotiqqq posted this in #help-forum
Open in Discord
I have home page with fetch info from wordpress

async function getHomeInfo() {
  const res = await fetch(
    `https://fsladmin.paxcore.ru/wp-json/wp/v2/pages/59`,
    {
      next: { revalidate: 60 },
    }
  );

  if (!res.ok) {
    throw new Error("Failed to fetch data");
  }

  return res.json();
}


When i in dev environment all is ok
Then i run build and get this (Home and other pages with revalidate fetch all are static)

Route (app) Size First Load JS
┌ ○ / 758 B 125 kB
├ ○ /_not-found 876 B 84.8 kB
├ λ /api/email 0 B 0 B
├ λ /api/order 0 B 0 B
├ λ /category/[id] 188 B 95.2 kB
├ ○ /contacts 1.32 kB 104 kB
├ ○ /partners 188 B 95.2 kB
├ ○ /productswp 1.57 kB 96.6 kB
└ λ /productswp/[productId] 5.65 kB 138 kB

at first, after the deployment, the data is updated, but then it stops, I don't know exactly how long, maybe after a day or a few.

Now i had 2 identical sites, 1 hosted on vps, the second on vercel. I made a new deployment on vercel, the application was rebuilt there, and the data began to be updated, but the data is still not updated on the vps, although the code is the same there and there

HTTP/1.1 200 OK
Server: nginx/1.24.0
Date: Fri, 19 Jan 2024 16:46:40 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 78033
Connection: keep-alive
Vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Url, Accept-Encoding
x-nextjs-cache: STALE
X-Powered-By: Next.js
Cache-Control: s-maxage=60, stale-while-revalidate
ETag: "4ohlxcnzi21lh0"

1 Reply

Basset Fauve de Bretagne
Did you understand the issue? Asking because im using unstable_cache with revalidation of 6h, after deployment it works and it was revalidated like 1 or 2 times. After that, it stopped, now getting stale data for the last 15 hours -.- not really sure what's going on