Next.js Discord

Discord Forum

revalidation not working after using "next build && next start". next: 13.5.3

LaPerm posted this in #help-forum
Open in Discord
let BASE_URL = ''; const getData = async () => { const d = await fetch(BASE_URL + '/home/hero_section', { next: { revalidate: 11 }, }); let data = await d.json(); return data; }; export default async function Home() { const data = await getData(); return <div>{data.title}</div>; }
What I am trying to achieve is, it should generate the page on server and display it for 11 seconds. And if I change some data in the backend for '/home/hero_section' route then it should rebuild the page and display it.
It works fine as long as I don't change /home/hero_section route is giving same data. But when it give different data, it will show older data even after I refresh the page or press "ctrl+shift+r" and even after 1 minute.
The main problem arises when I open the same page in incognito page, then it will only show blank page. I tries to look in the network tab but it is making one request to localhost:3000/ which is expected but in the response tab it is showing
"Failed to load response data: No resource with given identifier found"
and in the status it is saying 304 Not Modified.
In the older versions also 13.4.* it was giving the same error.
Can anyone please help?

0 Replies