Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start application while database is not available #12

Open
dschlarmann opened this issue Jan 17, 2024 · 1 comment
Open

Start application while database is not available #12

dschlarmann opened this issue Jan 17, 2024 · 1 comment
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@dschlarmann
Copy link
Contributor

Currently, the application fails to start if the underlying database is not available. The following output is logged:

[Nest] 32400  - 17.01.2024, 21:11:29   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
AggregateError:
    at internalConnectMultiple (node:net:1114:18)
    at afterConnectMultiple (node:net:1667:5)

It would be nice if the application would start anyway.

@dschlarmann dschlarmann added enhancement New feature or request wontfix This will not be worked on labels Jan 17, 2024
@dschlarmann
Copy link
Contributor Author

As far as I can see there is no option to realize this requirement. The underlying TypeORM module does not offer the needed functionality. More information here: https://stackoverflow.com/a/74046031/2873979

As an workaround we could increase the maximum retries as well as retriesDelay. Of course this does not solve the actual problem, but it would offer a softer behavior.
Check the following docs: https://docs.nestjs.com/techniques/database#typeorm-integration --> Properties retryAttempts and retryDelay

Keep in mind: We should not set the above mentioned properties to an infinite value, since this would only result a later error. If the database is not available, the database itself properly won't be available later on.
Instead we should check the "operational" approaches using Rancher, kubernetes, ingress, ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant