Next.js Discord

Discord Forum

Time based fetch revalidate and 204 response

Unanswered
Blood cockle posted this in #help-forum
Open in Discord
Blood cockleOP
Hi, does NextJS count fetch() -> 204 empty response as "failed cache revalidation". Meaning that if data gets removed from external API and the request returns 204 -> it doesnt revalidate the fetch data cache and keeps returning the old content it previously had with previous and successful request? If so, how can I force it to revalidate cache when 204 response occur?

1 Reply

I don’t think Next.js is opinionated about status codes. If you want to revalidate your fetch calls every certain period of time do [this](https://nextjs.org/docs/app/api-reference/functions/fetch):
// External endpoints
fetch(`https://external-url...`, { next: { revalidate: false | 0 | number } })

// Route handlers endpoints
fetch(`/api/whatever...`, { next: { revalidate: false | 0 | number } })