nitrojs / nitrojs/nitro

RouteRoules SWR not working on Netlify

Open
#2,617 6 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment

production

Reproduction

https://nitrocachetest.netlify.app/test_swr_time

In this app i have one route setup like this

export default defineNitroConfig({
srcDir: "server",
routeRules: {
'/test_swr_time': { swr: 10 },
'/test_swr_true': { swr: true }
}
});

Expected result is that every 10 seconds i should see the cache regenerate but is not, is cached forever

the code of the app is here
https://bitbucket.org/displaydevteam/nitro_test/src/main/

Describe the bug

with a swr 10 setting i exect the page to change every 10 second by invalidating the cache, but is not happening.

Additional context

This is related to this
https://github.com/nuxt/nuxt/issues/25418#issuecomment-2228954510

Logs

No response

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 by reproducing the behavior at https://nitrocachetest.netlify.app/test_swr_time and inspect the linked Bitbucket test app's routeRules configuration. Compare Nitro's SWR handling for swr: 10 and swr: true on Netlify with the related Nuxt issue; done means the page cache regenerates after the configured interval instead of remaining cached indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.