Replies: 2 comments
-
Does anyone have an idea what could be wrong. I will add that the problem also occurs when there are no errors from the api. It's like it occurs randomly. |
Beta Was this translation helpful? Give feedback.
-
I've discovered a similar issue in our page using Next.js 14.2.29 with the Pages Router. The specific problem appears in our getStaticProps function: export async function getStaticProps({
locale,
previewData,
revalidateReason,
}) {
try {
// ...existing code...
if (!page) {
return {
notFound: true,
revalidate: 60 * 60 * 2, // 2 hours in seconds,
}
}
// ...existing code...
} catch (error) {
// ...existing code...
}
} Even though we're setting revalidate: 60 * 60 * 2 (2 hours) for 404 pages, they seem to remain cached indefinitely. We've waited several days/weeks after content has been added to our CMS, but the page still returns 404. I'm wondering if we need to:
Has anyone found a reliable solution for ensuring 404 pages get revalidated with the Pages Router when content becomes available later? We're particularly interested in whether there are specific Next.js 14.x cache configuration parameters we should be adjusting. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have a next js app running on my dedicated server in docker container. I'm using ISR. For example on main page i have:
export const revalidate = 60;
For most of the time it works fine, page is caching and visit after 60s triggers revalidation, but sometimes in random moments for example once in a month ISR stops revalidating and page has old data and i have to restart container.
What i found in docker logs is that api was not responding for a few minutes. Probably next js tried to revalidate page, fetch data from api, api was not responding and next stopped retrying to revalidate this page:
3/15/2025, 3:22:57 PM Error [FetchError]: request to https://myapi.com/graphql failed, reason: socket hang up
at ClientRequest. (/app/.next/server/chunks/4759.js:13:47087) {
type: 'system',
errno: 'ECONNRESET',
code: 'ECONNRESET',
constructor: [Function: c]
}
3/15/2025, 3:22:58 PM Error [FetchError]: request to https://myapi.com/graphql failed, reason: read ECONNRESET
at ClientRequest. (/app/.next/server/chunks/4759.js:13:47087) {
type: 'system',
errno: 'ECONNRESET',
code: 'ECONNRESET',
constructor: [Function: c]
}
There is no other logs. I can't reproduce the issue in the local environment, even when I trigger errors in the API.
Has anyone experienced a similar issue with ISR in Next.js, where ISR stops working for specific page after some time or due to an error in fetching data from the API or has any ideas on how I can debug this issue?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions