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.

[nestjs] Incorrect shutdown

See original GitHub issue

Starting 13.8.4 (when @nrwl/node:execute was replaced by @nrwl/node:node) Nx incorrectly handles shutdown on NestJS apps with shutdown hook.

Steps to Reproduce

  1. Create an empty NestJS app using Nx
  2. Use the following AppModule
  3. Enable shutdown hooks
  4. Start the app using nx serve
  5. Send SIGTERM (Ctrl + C)

Current Behavior

1 log message:

  • onModuleDestroy before wait

Expected Behavior

3 log messages:

  • onModuleDestroy before wait
  • onModuleDestroy after wait
  • onApplicationShutdown

Environment

   Node : 17.5.0
   OS   : darwin arm64
   yarn : 3.2.0
   
   nx : 13.8.5
   @nrwl/angular : undefined
   @nrwl/cli : 13.8.5
   @nrwl/cypress : undefined
   @nrwl/detox : undefined
   @nrwl/devkit : 13.8.5
   @nrwl/eslint-plugin-nx : 13.8.5
   @nrwl/express : undefined
   @nrwl/jest : 13.8.5
   @nrwl/js : 13.8.5
   @nrwl/linter : 13.8.5
   @nrwl/nest : 13.8.5
   @nrwl/next : undefined
   @nrwl/node : 13.8.5
   @nrwl/nx-cloud : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : undefined
   @nrwl/tao : 13.8.5
   @nrwl/web : undefined
   @nrwl/workspace : 13.8.5
   typescript : 4.6.2
   rxjs : 7.5.4
   ---------------------------------------
   Community plugins:
         @nx-tools/nx-docker: 2.3.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jkossiscommented, Aug 4, 2022

@nartc why was this closed?

Using latest everything from nx, I am still experiencing the original behavior noted by @mark-b-ab.

0reactions
jkossiscommented, Aug 30, 2022

@nartc bumping this again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nest.js gracefully shutdown [duplicate] - Stack Overflow
I believe your problem might be that your NestJS instance is not listening for shutdown events. You need to enable that behavior with...
Read more >
Let It Crash: Best Practices for Handling Node.js Errors on ...
Some strategies to gracefully shutdown the Node.js process and quickly restart your application after a catastrophic error terminates your ...
Read more >
Rate Limiting | NestJS - A progressive Node.js framework
A common technique to protect applications from brute-force attacks is rate-limiting. To get started, you'll need to install the @nestjs/throttler package.
Read more >
Automatically restart Node.js apps with Nodemon
Nodemon tutorial: Automatically restart Node.js apps with Nodemon ... a new framework for building binaries; Compare NestJS vs. Express.js ...
Read more >
Best Practices for Node.js Error-handling - Toptal
They mean the code itself has some issues to solve and was coded wrong. ... Does it make sense to restart an application...
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