question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: fetch requests in middleware fail with a body

See original GitHub issue

Verify 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

  1. Load any page
  2. Observe the error in the console
  3. Remove the line body: ""
  4. Observe that there is no error

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
balazsorban44commented, Aug 3, 2022

This should be out on 12.2.4-canary.11, please check it out!

0reactions
github-actions[bot]commented, Sep 11, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found