nestjs / typeorm

TypeORM module for Nest framework (node.js) 🍇

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to keep app alive, if DB connection is failed

EnoRage opened this issue · comments

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Nest.app will be crashing if DB connection is dead. There is no way to configure such behavior.

Expected behavior

Allow to keep app alive if DB connection is dead.

Minimal reproduction of the problem with instructions

  1. Run nest js with TypeORM example
  2. Do not setup DB
  3. See crash

What is the motivation / use case for changing the behavior?

I have to controllers, one of them is not depends on DB. I want my app to be alive and return some data instead of crashing everything.


Nest version: X.Y.Z

 
For Tooling issues:
- Node version: XX  
- Platform:  Mac + Docker

Others:
 "@nestjs/typeorm": "^7.1.5"
 "@nestjs/common": "^7.6.15"
 "@nestjs/core": "^7.6.15"

Do you mean this one?

image


I didn't understand the Do not setup DB part.

If I use TypeORMModule.forRoot and the DB server dies, the app is kept alive. Here's the code. I got the above error when the DB server isn't alive when starting the app.

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.