NextJS: API resolved without sending a response for /xx/xx, this may result in stalled requests.
See original GitHub issueChecks
- I understand project setup issues should be asked on StackOverflow or in GitHub Discussions.
- I updated to latest
http-proxy-middleware
.
Describe the bug (be clear and concise)
I’m trying to setup local proxy while it’s working fine for all the requests, it doesn’t work for POST requests including data. I have disabled bodyParser but it didn’t help.
I also created an issue about this but it doesn’t seems to be next.js issue but I’m not sure. Issue: https://github.com/vercel/next.js/issues/36811 Discussion: https://github.com/vercel/next.js/discussions/36859
Step-by-step reproduction instructions
1. create api in next project
2. send a post request including data (like a login api)
3. you will see that the request won't be resolved
Expected behavior (be clear and concise)
I expect to resolve the api with a response.
How is http-proxy-middleware used in your project?
=> Found "http-proxy-middleware@2.0.6"
info Has been hoisted to "http-proxy-middleware"
info This module exists because it's specified in "devDependencies".
info Disk size without dependencies: "184KB"
info Disk size with unique dependencies: "592KB"
info Disk size with transitive dependencies: "2.83MB"
info Number of shared dependencies: 11
✨ Done in 0.44s.
### What http-proxy-middleware configuration are you using?
```typescript
const proxy = createProxyMiddleware({
logLevel: 'debug',
target: 'XXX',
changeOrigin: true,
autoRewrite: true,
});
export default proxy;
What OS/version and node/version are you seeing the problem?
macOS, node 16
Additional context (optional)
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:11 (4 by maintainers)
Top Results From Across the Web
API resolved without sending a response for /XXXX ... - GitHub
API resolved without sending a response for /XXXX/XXXX, this may result in stalled requests.
Read more >NextJs - Node - API resolved without sending a response for ...
I wrapped the sendmail call in a promise and that seems to have worked. var promise = new Promise( (resolve, reject) => {...
Read more >Static Site Generation with Next.js and TypeScript (Part II)
js application. Below, I'm going to show you how to fetch data from an API with getStaticProps . Installation and Setup ...
Read more >WebSockets and Node.js - testing WS and SockJS by building ...
This post will look at implementing a couple of low-level WebSockets libraries with Node.js as the WebSocket server. We'll look at how each...
Read more >Build a Next.js Application with TypeScript - Okta Developer
Learn how to use Typescript to build a Next.js application.
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
I was stuck with this for a while. I was able to solve it using API config (in Next.js), I had to disable bodyParser.
Just in case anybody is unable to read like me, I originally misinterpreted this and added
bodyParser: false
to the middleware configuration, which did not help. Adding this to the Next.js API config like @JacerOmri mentioned was the fix!