Open SkelatorIndy opened 1 month ago
I believe this is a duplicate of #1569 ?
The solution of manually replacing the fetch for the request with the standalone fetch does work, and because of the small scope of where this error occurs it is not a bad solution. However, since that issue mentioned a fix being merged in, and the follow up mentions specifically that the GET requests are fine, which mine is not, I was unsure if this may be a separate but related issue. However, if you do believe it is a duplicate of the same issue mentioned there, then this issue can be closed as a duplicate.
I'm going to take a look at the issue, I'm supposed to have made a PR trying to resolve this but it doesn't seem to cover some cases.
Description
When using the openapi-fetch client in Next.js 14.2.4's
middleware.ts
file, it causes the app to errorClient Error![image](https://github.com/openapi-ts/openapi-typescript/assets/13159212/c76538e0-2f0c-4642-af6e-d7803c2abdd2)
Server Error![image](https://github.com/openapi-ts/openapi-typescript/assets/13159212/76eea27e-652b-4dcf-9c52-4ed55219e5d5)
Reproduction
This can be reproduced by using the openapi-fetch client in the
middleware.ts
file of Next.js. The error does not occur if you use the standalone fetch clientCauses Error:
Works:
I made a sandbox using the latest version of Next.js showing this error occurring with a very minimal setup: Sandbox Reproduction
Expected result
Should be able to use openapi-fetch in
middleware.ts
Checklist