Empty Nitro cache on Vercel deployment

Hi everyone, I'm trying to figure out how to clear my Nitro cache when deploying to vercel. I thought it would be automatic, but only he Vercel cache is properly cleared, not the Nitro one. I have to manually call my custom endpoint in order to call cache.removeItem('nitro:handlers:......) PS: I use KV for storage. Any idea? Thanks!
3 Replies
kapa.ai
kapa.ai2w ago
Hi @CedsTrash. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To address your question about clearing the Nitro cache on Vercel deployment, I'll provide some insights based on the available information: 1. Vercel KV Storage: Since you're using KV for storage on Vercel, it's important to note that Vercel KV is designed to persist data across deployments. This means that the Nitro cache stored in KV won't automatically clear on new deployments. 2. Manual Cache Clearing: Your current approach of manually calling a custom endpoint to clear the cache using cache.removeItem() is a valid workaround, but it's not ideal for automatic deployments. 3. Deployment Hooks: One potential solution is to use Vercel's deployment hooks. You could create a deployment hook that triggers your cache-clearing endpoint automatically after each successful deployment. 4. Build-time Cache Clearing: Another approach could be to clear the cache during the build process. You might be able to add a build step that clears the cache before the new deployment is finalized. 5. Nitro Configuration: There might be Nitro configuration options that can help with cache management, but the provided knowledge sources don't contain specific information about automatic cache clearing on Vercel deployments. Unfortunately, the knowledge sources don't provide a direct, out-of-the-box solution for automatically clearing the Nitro cache on Vercel deployments. The issue seems to be related to the persistence of KV storage across deployments, which is a feature of Vercel's infrastructure. For a more definitive solution, you might want to: 1. Check the Nuxt documentation for any updates on cache management with Vercel deployments. 2. Consider opening an issue on the Nuxt GitHub repository to request this feature or get more specific guidance from the Nuxt team. 3. Explore Vercel's documentation for any advanced deployment configurations that might allow for automatic cache clearing of persistent storage. If you need a more immediate solution, continuing with your current method of manually clearing the cache or implementing a deployment hook to automate this process might be the best temporary approach. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@1014896388758323331> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
CedsTrash
CedsTrashOP2w ago
That's what I ended up doing yes, and it works fine! Thanks!

Did you find this page helpful?