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.

Middleware is causing POST/PUT requests with large payload to stuck

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: darwin
  Arch: x64
  Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
Binaries:
  Node: 16.14.0
  npm: 8.5.0
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 12.2.6-canary.8
  eslint-config-next: 12.2.5
  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)

next run dev

Describe the Bug

When middleware.ts is present, POST and PUT requests with large payloads to any apis in the pages/api folder are stuck on pending.

The payload I was using has Content-Length: 30233, so even if in default api setting it should not be too big.

https://user-images.githubusercontent.com/57633889/188248378-46958c68-9781-4dea-b8a9-03232eb5959a.mov

Expected Behavior

POST and PUT requests should be working with middleware present.

Link to reproduction

https://github.com/louisesiqifan/next-js-huge-post

To Reproduce

  1. Run npm i
  2. Run npm run dev
  3. In http://localhost:3000/, click the two buttons

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
mgreenwcommented, Sep 15, 2022
0reactions
github-actions[bot]commented, Oct 17, 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

`await call_next(request)` gets stuck indefinitely on larger ...
When implemented, response = await call_next(request) gets stuck indefinitely when the JSON payload is too large. What could be the reason?
Read more >
HTTP request methods - MDN Web Docs
Chrome Edge CONNECT Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history DELETE Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history GET Full...
Read more >
Nodejs Security - OWASP Cheat Sheet Series
However, fixing a request size limit for all requests may not be the correct behavior, since some requests may have a large payload...
Read more >
NetSuite Applications Suite - SuiteTalk REST Web Services ...
Common Causes of Site Performance Issues · Reduce Repeated Calls with ... a simple portlet that posts data to a servlet · GET,...
Read more >
Node.js Express: JWT example | Token Based Authentication ...
JWT Authentication Middleware: verify SignUp, verify token ... sends request for an endpoint using HTTP request (GET, POST, PUT, DELETE), ...
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