Next.js Discord

Discord Forum

Debugging cache HIT/MISS on requests locally

Answered
Wesley Janse posted this in #help-forum
Open in Discord
Avatar
Hey all, I am seeing on Vercel (enterprise), that in my logging all cache responses return a MISS. While I am using the fetch api without any third party data fetching libraries.

Previously I was able to see the fetch, with cache header HIT/MISS inside of my development console. but since the latest update to 13.5, I no longer see this information in my console.

Also can't really find any new information about this in the changelog, or I am reading over it...

If anyone has a tip, it would help me a lot. Thanks in advance!
Answered by Wesley Janse
Alright I found the issue, did not read the docs of next-intl good enough. Implemting it with RSC support, means that it automatically opts the pages into dynamic rendering.
View full answer

18 Replies

Avatar
It should load instantly if data is cached. It should takes a while if data is awaited/being fetch. Maybe you can determine based on that instead?
Avatar
Yes, but im not doing anything special, just fetch. Should be force cached by default. But still on vercel all is a miss. And loading times are not so good since data is fetched every time
Avatar
^ this, plus u can additionally slow down your api to have more clearer results. Disabling and re-enabling cache for a domain browser-side to the difference is also a viable choice
Is it caching on npm run build && npm start?
you might want to check up on the vercel's data cache docs aswell.
Avatar
Yes i have, just strange that the default cache request debug in console is gone with the latest update
It was a usefull insight
Nope the same result as deployed on vercel
Avatar
Have you checked out the next docs to see if maybe you're doing something that is opting your fetch request out of caching?
Image
Avatar
Ill have to check if im not using cookies or something, but normally not. Thanks for the lead, ill investigate
Avatar
So, I am using next-intl middleware, it seems like they are setting, getting cookies within that middelware, but that should be on route path right? or do middlewares also run through rsc fetches?
Avatar
what do even mean by "rsc fetches"? And yes middleware runs on the server
Avatar
Yeah they do
Like the ones that returns rsc jsons
Avatar
Yes, was looking for a way to say it
Avatar
Alright I found the issue, did not read the docs of next-intl good enough. Implemting it with RSC support, means that it automatically opts the pages into dynamic rendering.
Answer
Avatar
thanks for the help 😉