Next.js Discord

Discord Forum

Revalidate not working on build, but works on dev. Next 13.5.6

Unanswered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
Hi, I am aware that this issue happen to all of you before. But I didn't find any comment with solution.

This is the code I'm using for a job assessment that is needed to be done in NextJS 13.

export const metadata = {
title: "Privacy Policy",
};

const PrivacyPolicy = async () => {

const res = await fetch(
https://loripsum.net/generate.php?p=5&l=medium&d=1&a=1,
{
headers: {
"Content-Type": "text/html",
},
next: { revalidate: 10 },
}
);

const result = await res.text();

return (
#Unknown Channel
<h2 className="text-xl font-bold mb-3">Privacy Policy</h2>
<div dangerouslySetInnerHTML={{ __html: result }} />
</>
);
};
export default PrivacyPolicy;


From this I am expecting that every 10 seconds after second refresh of the page I get updated content from the loripsum.net. But content does not change. It works like it should on dev (npm run dev). But when I build it (npm run build and npm start) it shows the same content all the time.

1 Reply

Toyger
on dev you don't have caches.
it can be problem with specific version, ideally if you'll update to last version of nextjs.