Why does on demand revalidation res.revalidate() fail with timeout after 300 seconds?
Unanswered
Irish Red and White Setter posted this in #help-forum
Irish Red and White SetterOP
I am troubleshooting an intermittent issue regarding revalidation of our pages.
We do our revalidation very much like this,
https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#using-on-demand-revalidation
When this works, our paths get revalidated and we see
But quite often, we have failures. In this case, there is a 300 second wait until it times out and throws an error:
What is significant is that
This is on Next 12.2.4, not hosted on Vercel.
We do our revalidation very much like this,
await res.revalidate(slug)
:https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#using-on-demand-revalidation
When this works, our paths get revalidated and we see
getStaticProps
getting called.But quite often, we have failures. In this case, there is a 300 second wait until it times out and throws an error:
2024-08-16T11:45:00.6916767Z TypeError: fetch failed
2024-08-16T11:45:00.6917100Z at node:internal/deps/undici/undici:13178:13
2024-08-16T11:45:00.6917141Z at async /app/nextdist/server/chunks/3249.js:95:40 {
2024-08-16T11:45:00.6917174Z [cause]: HeadersTimeoutError: Headers Timeout Error
2024-08-16T11:45:00.6917253Z at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:5975:32)
2024-08-16T11:45:00.6917309Z at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:2356:17)
2024-08-16T11:45:00.6917359Z at listOnTimeout (node:internal/timers:581:17)
2024-08-16T11:45:00.6917462Z at process.processTimers (node:internal/timers:519:7) {
2024-08-16T11:45:00.6917515Z code: 'UND_ERR_HEADERS_TIMEOUT'
2024-08-16T11:45:00.6917546Z }
2024-08-16T11:45:00.6917578Z }
What is significant is that
getStaticProps
is never even called. We draw this conclusion by have console logs at the top of getStaticProps
that we see working generally, but never called in these failing cases.This is on Next 12.2.4, not hosted on Vercel.