-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Description
Link to the code that reproduces this issue
https://github.com/mbozhik/apt/tree/cache
To Reproduce
-
Clone the reproduction repository: https://github.com/mbozhik/apt (cache branch)
-
Install dependencies and start the application in development mode:
pnpm install
pnpm dev
-
Trigger the
fetchSheetData
function by navigating to the relevant route or making an API request (e.g. open /some-page that calls the function). -
Observe caching behavior:
- First request takes ~12s (live fetch from API)
- Subsequent requests return in ~500ms, confirmed via console logs starting with Cache
- Deploy the same code to Vercel with identical configuration.
- Perform the same requests in production.
- Observe that every request takes ~12s, with no Cache logs and no caching.
Current vs. Expected behavior
When following the reproduction steps, the application correctly caches requests in development mode. After the first API call (~12s), subsequent requests are returned in under 1 second and visibly marked with Cache logs — confirming that caching is working as expected.

However, when deployed to Vercel in production, caching fails entirely. Every request triggers a full API call (~12s), with no sign of caching behavior:
- No Cache logs
- Identical repeated requests show no speedup
- Caching directives ('use cache', cacheTag, cacheLife) are correctly placed but seemingly ignored


Expected behavior:
Vercel production should match development caching — cached responses returned in <1s with logs confirming cache hits.
The discrepancy severely impacts UX, making production performance 10–15x slower than expected for identical requests.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 16
Binaries:
Node: 22.15.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.10.0
Relevant Packages:
next: 15.4.2-canary.33
eslint-config-next: N/A
react: 19.1.1
react-dom: 19.1.1
typescript: 5.8.3
Next.js Config:
output: N/A
Deployment:
Platform: Vercel (Production)
Which area(s) are affected? (Select all that apply)
Use Cache
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
- Reordered cache directives (cacheTag and cacheLife) — no effect.
- Switched from axios to native fetch.
- Removed all console.log calls inside cached functions.
- Verified next.config.ts experimental settings (useCache, cacheComponents) and deployment configuration.