Using @Res() the response freezes
See original GitHub issueBug Report
Current behavior
When the controller method has @Res as a parameter, the response freezes
Input Code
...
import {Response} from 'express'
import {Res} from '@nestjs/common'
...
@Get(':id')
findOne(@Param('id') id: string, @Res() res: Response) {
const user = this.usersService.findById(id)
return user
}
Without @Res()
With @Res()
Environment
Nest version: 7.5.1
For Tooling issues:
- Node version: v14.11.0
- Platform: Windows
- Using TypeORM
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Nodejs Express - res.send(<a very long string>) freeze when ...
From my experience, what I can understand is you should call the callback when the whole process is over,. And also, you are...
Read more >Does using "then" to fetch a request freezes the entire ... - Reddit
No. Any callbacks in then() or catch() will be placed in the event loop to run,which means they will run only when currently...
Read more >Client-Server communication; client freezes - CodeRanch
Hi, the story: Clients sends a request, server reads that request, and sends a response, lastly client reads the response.
Read more >Top 10 Most Common Node.js Developer Mistakes - Toptal
Often, reasons for such criticisms are rooted in how developers use/misuse the language. This article explores ten common mistakes that Node.js developers ...
Read more >Outlook not responding, stuck at "Processing," stopped ...
Repairing your Office programs can resolve issues with Outlook not responding or freezing. Errors in Microsoft 365 files are repaired automatically.
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 Free
Top 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
Yes, in the documentation it’s mentioned that if you use
@Res()
for any reason in that route handler (class method) you must handle the response yourself. If you do not handle it, the request hangs. This is the expected functionality. I would love to help you if you are noticing something other than that, but so far it doesn’t sound like that is the case.And apologies if I come off as rude, but we have a discord server dedicated to support and many times we get people submitting issues without fully reading the documentation.
If you’re still having a problem, please provide a minimum reproduction repository and we’ll take a look as soon as possible.
My friend, I will explain again. The scenario is that just by using @Res as a parameter it freezes when serializing the object in the response. If I return @ Res.send () it works, but when serializing it freezes. If you don’t want to help me, don’t be unpleasant either, we are on the same side of the opensource initiative, trying to help improve what we can.