Regression: fetch requests in middleware fail with a body
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Fri, 15 Jul 2022 15:33:02 +0000
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 3.2.1
pnpm: N/A
Relevant packages:
next: 12.2.4-canary.0
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Making a fetch
request from middleware that includes a request body fails with TypeError: fetch failed
.
Tested in 12.2.2
- succeeds. Fails in 12.2.3
and canary
.
Expected Behavior
The fetch request should succeed.
Link to reproduction
https://codesandbox.io/s/jovial-fast-yflq3w?file=/middleware.ts
To Reproduce
- Load any page
- Observe the error in the console
- Remove the line
body: ""
- Observe that there is no error
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Getting "TypeError: Failed to fetch" when the request hasn't ...
The issue is when I send a get request, I'm receiving a valid response from the server but also the fetch API is...
Read more >Changelog - Cypress Documentation
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where ... fetch requests are always displayed in the Command Log, regardless...
Read more >GraphQL Code Libraries, Tools and Services
Relay aggregates queries into efficient network requests to fetch only what you need. ... GraphQL Middleware is a schema wrapper which allows you...
Read more >Tutorial: Call an ASP.NET Core web API with JavaScript
A Fetch request is configured with the following options: method —specifies the POST HTTP action verb. body —specifies the JSON representation ...
Read more >Fullstack part4 | Testing the backend
The catch block simply calls the next function, which passes the request handling to the error handling middleware. After making the change, all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be out on
12.2.4-canary.11
, please check it out!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.