-
-
Notifications
You must be signed in to change notification settings - Fork 528
Use in Next.js's middleware.ts causes error #1718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem. |
@FreeAoi There is no PR linked with this issue, has this been resolved in the mean time? |
Description
When using the openapi-fetch client in Next.js 14.2.4's
middleware.ts
file, it causes the app to errorClient Error

Server Error

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
The text was updated successfully, but these errors were encountered: