nitro icon indicating copy to clipboard operation
nitro copied to clipboard

swr + proxy requests

Open AndersCV opened this issue 5 months ago • 3 comments

Environment


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

Reproduction

https://stackblitz.com/edit/nuxt-starter-51fgbr

Describe the bug

When proxying api requests through Nitro that have caching enabled from routeRules the response object is malformed. In the reproduction i linked I'm using a catch-all endpoint to proxy requests from Nitro to an external backend. With caching enabled the response returned from this endpoint is malformed.

Happens when using the h3 proxyRequest method. Switching to $fetch resolves the issue.

Additional context

No response

Logs

No response

AndersCV avatar Jan 23 '24 09:01 AndersCV