nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Caching with Nitro `routeRules` breaks server/routes

Open AndersCV opened this issue 1 year ago • 1 comments

Environment


  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: ^3.10.1
  • CLI Version: 3.10.0
  • Nitro Version: -
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, routeRules
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-ftdurl

Describe the bug

I have a routeRules defined in my nuxt.config.ts like this: routeRules: { '/uk/some-random-slug': { swr: true }, },

I have a server/route like this: server/routes/[locale]/verify-email.ts

Now accessing my server/route at: uk/verify-email does not work de/verify-email works fine

Even though my routeRule is a named route it still conflicts with my server route causing it to return the incorrect data. If you disable caching it works again.

Additional context

No response

Logs

No response

AndersCV avatar Feb 08 '24 05:02 AndersCV

Is there any chance someone can take a look at this? Maybe I'm doing something wrong but I doubt this is the intended functionality.

AndersCV avatar Feb 19 '24 13:02 AndersCV