I have some HTTP requests that need to be cached for say, 12 hours. These requests get executed after cookies are read.
Originally I was using unstable_cache to bundle two of these requests into one and cache them, but I noticed that in my Vercel log Request Metrics that the requests were seemingly still firing while also pulling from the cache. Because for whatever reason, unstable_cache data cache reads only show up as "undefined" in the usage panel, I decided to try just use fetch() caching so I could see the URL in the usage panel.
I removed the unstable_cache call and now my Request Metrics are showing requests firing every time with nothing about the cache. Neither URL are appearing in my data cache usage panel.
In the first image, the top two requests are being cached:
fetch(`.../${myVar}`, {
next: {
revalidate: 60 * 60 * 12,
tags: ["my-tag", myVar],
}
})
The bottom request is also being cached but is a POST request. The docs say that fetch won't cache when called /after/ cookie access, but I'm absolutely sure this used to work just fine.
In image 2, this is what Request Metrics looked like for the same route before I made these changes. I've drawn which cache call corresponds to which request. If the cache was hit, why are the requests still seemingly executing?
I'm on 14.2.3. In local dev, I can see logging show cache hits. Is Vercel just not showing data cache stuff as soon as the log is made?