Caching issue with Next.js App Router - Vercel Deployment

I was also having this issue even with access token and next 14.0.4. Specifically I was having this issue with API routes which I'm using to update my search index when documents are published/deleted.

I'm pretty sure it's due to the default createClient function having "force-cache" which resulted in all routes, even API POST routes (which are supposed to avoid caching as far as I understand) having Next.js fetch caching forced.

I resolved this on my project by adding

export const fetchCache = 'force-no-store'; to the top of each API route that I wanted to avoid caching.

I also have export const revalidate = 0; in my routes, but I'm pretty sure only the fetchCache export is required to fix.

Here are some more relevant options that may be useful for people who still have issues with this as there are a lot of different ways to control caching per route.

2 Likes