-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
POST request from middleware fails #39060
Comments
I debugged this a bit myself, maybe this is useful: The
So
Note that the provided default has no
But
I also noticed that this problem only happens during local development. The problem does not seem to exist when the application is actually deployed. |
is there a solution yet? |
See #38963 (comment) |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Fetch requests made from middleware fail but only if the request is a POST request with a request body.
Expected Behavior
The middleware should be able to make POST requests.
Link to reproduction
https://github.com/dferber90/nextjs-fetch-bug-reproduction
To Reproduce
Create a new Next.js project, eg
pnpm create next-app --ts
.Add a
middleware.ts
file at the root with:You will now see the red warning box.
Additionally, the middleware will have logged the error to the terminal:
The text was updated successfully, but these errors were encountered: