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.

Using @Res() the response freezes

See original GitHub issue

Bug 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()

image

With @Res()

image

Environment


Nest version: 7.5.1

 
For Tooling issues:
- Node version: v14.11.0  
- Platform: Windows 
- Using TypeORM


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
jmcdo29commented, Sep 20, 2020

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.

6reactions
nichmorgancommented, Sep 20, 2020

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.

Read more comments on GitHub >

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

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