nitrojs / nitrojs/nitro

Cache invalidation is not working on production (vercel or netlify)

Open
#3,105 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug cache preset:vercel v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment

nitro 2.10.4
node: 20.15.1

Reproduction

https://github.com/cfab/github-test-cache-nitro

Describe the bug

It works perfectly when in local development
if you go to /api/time you get the time. The returned time is cached for a duration of 60 seconds.
if you go to /api/invalidate you precisely invalidate the cache of the other route.

When deployed on netlify or vercel, the cache invalidation is not working.
You can check this on https://github-test-cache-nitro.vercel.app/api/invalidate
Is this a bug or is this something wrong with my code ?

Same issue opened on nuxt repo: https://github.com/nuxt/nuxt/issues/31030

Additional context

No response

Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository and exercise /api/time and /api/invalidate locally, then compare the behavior on the deployed Vercel or Netlify app. Read the Nitro cache invalidation path and deployment adapter behavior implicated by the reproduction. Done means invalidation reliably refreshes the cached /api/time response in production as it does locally.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.