Add Server Startup Hooks #43630
Replies: 3 comments 1 reply
-
Please do not bucket this under discussion -- this is a feature request. The associated discussion is here: #15341 |
Beta Was this translation helpful? Give feedback.
-
Hi, feature requests are converted to discussions as outlined in the contribution docs, as well as the issue template you filled out. |
Beta Was this translation helpful? Give feedback.
-
Super basic feature - absolute necessary for every server application. Current solution with instrumentation is very unreliable. I’m very surprised how nextjs could exist for almost 10 year without a “regular” server lifecycle. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
This feature has been requested for over 2 years now in this discussion thread with no response from Vercel: #15341
I belive @mschipperheyn described it very simply:
This feature is necessary since standalone mode does not work with custom servers. Being able to initialize a prism connection pool or telemetry at the start of an application is standard for use with API routes.
Describe the solution you'd like
Provide any sort of hook/function/subscribe-able event that developers can use to have code run once at server startup.
Describe alternatives you've considered
I have considered using a custom server to do this, but it does not work with standalone mode. Standalone ignores your custom server and generates its own.
Beta Was this translation helpful? Give feedback.
All reactions