Next.js Discord

Discord Forum

Cache Revalidation for API Errors

Unanswered
Philippine Crocodile posted this in #help-forum
Open in Discord
Philippine CrocodileOP
The Next.js documentation states the following:

If an error is thrown while attempting to revalidate data, the last successfully generated data will continue to be served from the cache. On the next subsequent request, Next.js will retry revalidating the data.

I have a revalidation delay of 1 hour for API requests. Is there a way to use a revalidation delay for when the API errors? My API went down earlier today which massively increased function duration as an API request had to made for every new request. I would rather that the app uses a (potentially shortened) delay before revalidation attempts when the API is erroring.

0 Replies