Invalidate fetch error result in 500 internal server error
Unanswered
Willem Liu posted this in #help-forum
Hi,
I have a question regarding RSC fetch and data cache. From the docs I'm to believe that while revalidating, any fetch-error would result in the page not being revalidated and the old-cached page to be served instead: https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#error-handling-and-revalidation
However I've tested this locally and on Vercel and when the requested endpoint doesn't exist or has invalid data (and my code throws an error during the fetch promise chain) the website will serve out a 500 error.
I've tried this both with plain GET and POST fetch requests (requesting a simple static JSON response from an endpoint).
My expectation is that the old cached page will be served instead of a 500 error. Am I missing something?
Many thanks in advance.
I have a question regarding RSC fetch and data cache. From the docs I'm to believe that while revalidating, any fetch-error would result in the page not being revalidated and the old-cached page to be served instead: https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#error-handling-and-revalidation
However I've tested this locally and on Vercel and when the requested endpoint doesn't exist or has invalid data (and my code throws an error during the fetch promise chain) the website will serve out a 500 error.
I've tried this both with plain GET and POST fetch requests (requesting a simple static JSON response from an endpoint).
My expectation is that the old cached page will be served instead of a 500 error. Am I missing something?
Many thanks in advance.