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

Controllers not available when OnApplicationBootstrap fires #2795

Closed
hardcodet opened this issue Aug 22, 2019 · 3 comments
Closed

Controllers not available when OnApplicationBootstrap fires #2795

hardcodet opened this issue Aug 22, 2019 · 3 comments

Comments

@hardcodet
Copy link

Bug Report

Current behavior

The lifecycle docs state that when OnApplicationBootstrap happens: Called once the application has fully started and is bootstrapped. However, controllers are not accessible at this time.

Context: I'm trying to register a webhook with Nest during that event. The webhook provider immediately sends a test message to the registered endpoint (my Nest application), and fails because the request is not routed. If I introduce an artificial delay, the registration works.

Expected behavior

The event should probably fire once the app is indeed ready, and requests are being routed, no? Alternatively, maybe second event? Basically one to finalize after bootstrapping, and one to work when the app is actually live?

Environment

Nest version: 6.5.3

@hardcodet hardcodet added the needs triage This issue has not been looked into label Aug 22, 2019
@kamilmysliwiec
Copy link
Member

At the moment, we do call onApplicationBootstrap hook when the entire application is initialized (async providers are instantiated, modules graph resolved), but before listen() is triggered. We should probably change this behavior cc @BrunnerLivio

@hardcodet
Copy link
Author

Glad to hear! I'd suggest the two event version - one before (as a final setup task), one after listen. That wouldn't break existing code, and there's merit in having both, no?

underfin pushed a commit to underfin/nest that referenced this issue Sep 9, 2019
@BrunnerLivio BrunnerLivio removed their assignment Oct 11, 2019
@kamilmysliwiec
Copy link
Member

#2983 (comment)

@nestjs nestjs locked and limited conversation to collaborators Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants