Next.js Route Handler GET returns old JSON after upgrade
After changing the configuration endpoint /api/config shows the previous values, although the database has new data. Cache and the way routers are rendered depend on the Next.js version and the explicit revalidate or fetch settings.
How to identify the source of the problem
Check the framework version and endpoint response on the Network with the appropriate cache headers. Compare data read directly in the database and result of the same request without CDN or browser cache.
Compare the message from the console with the result of the production compilation and the condition after the page has been refreshed.
Repair steps
For fresh data, configure the appropriate cache-control or dynamic behavior and clearly label the operation as dynamic. For data that can be cached, set the foreseeable refresh time and controlled cancellation cache.
How to Test Solution
After changing the record, the API returns a new value in the required time, and the necessary cache remains effective.
Security and restrictions
Do not copy cache configuration between different versions of Next.js without checking its meaning.