Debugging cache HIT/MISS on requests locally
Answered
Wesley Janse posted this in #help-forum
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!
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.
18 Replies
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?
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
^ 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.
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
Have you checked out the next docs to see if maybe you're doing something that is opting your fetch request out of caching?
Ill have to check if im not using cookies or something, but normally not. Thanks for the lead, ill investigate
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?
what do even mean by "rsc fetches"? And yes middleware runs on the server
Yeah they do
Like the ones that returns rsc jsons
Yes, was looking for a way to say it
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
thanks for the help 😉