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

Improve FAQ Hybrid application Docs to clarify bootstrap order #2478

Closed
1 of 5 tasks
haimprecise opened this issue Oct 1, 2022 · 1 comment
Closed
1 of 5 tasks

Improve FAQ Hybrid application Docs to clarify bootstrap order #2478

haimprecise opened this issue Oct 1, 2022 · 1 comment

Comments

@haimprecise
Copy link

I'm submitting a...

  • Regression
  • Bug report
  • Feature request
  • Documentation issue or request (new chapter/page)
  • Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The FAQ Hybrid Application Page does not mention anything about App Lifecycle Events and Microservice order.

Expected behavior

  1. Explain that Nest App Lifecycle Events start when you call await app.listen and not await app.create
  2. Explain that the order of await app.startAllMicroservices and await app.listen is crucial

Minimal reproduction of the problem with instructions

When utilizing Lifecycle Events such as onApplicationBootstrap / onModuleInit and consuming app's functionality inside Microservices, it is important to clarify that the order of the bootstrap lines plays an essential role:

For example:

await app.startAllMicroservices();
await app.listen(3001);

The lifecycle events will complete after the microservices have started.

await app.listen(3001);
await app.startAllMicroservices();

The lifecycle events will complete before the microservices have started.

We had a bug when our application started and a microservice was immediately consumed, before our Promises from modules' OnModuleInit functions have finished, throwing errors obviously.

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

To educate developers and to avoid future bugs. Had to debug your code to figure these things out...

Environment

For Tooling issues:

  • Node version: 18.3.0
@Tony133
Copy link
Contributor

Tony133 commented Oct 3, 2022

This is duplicated see here #2485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants