Why nitro doesn't wait for async plugins to complete operation?
I have a plugin that connects to mongodb. But connecting to mongodb takes some times. But nitro doesn't wait for that plugin to execute completely and then start the server. Instead it starts immediately (before connecting to mongodb) and starts responding. As a result error occurs.
Plugin code=>
3 Replies
Doesn't wait for any async function to execute completely
Plug-ins run synchronously as per docs. Track here: https://github.com/unjs/nitro/issues/915
GitHub
Make plugins async · Issue #915 · unjs/nitro
For the benefit of bootstrapping plugins it is usefull to make plugins load async. nitro/src/runtime/app.ts Lines 89 to 91 in ed3a480 for (const plugin of plugins) { plugin(app); } Can someone expl...
They haven't solved this yet