-
Notifications
You must be signed in to change notification settings - Fork 514
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
How to run one plugin after other #1768
Comments
Need one more hook like before request to use different hooks in each plugin. |
or to not make it async? whe I need a hook like |
And in |
You can order the plugins, it's written in the docs you linked : |
@Hebilicious that not help if it is async, and I need to await in it for db connection, and no at leas beforeRequet hook to use in one beforeReques and in other request hook I will move code from plugin to hook in plugin and make plugin not async
But ca't stop bd
|
@Hebilicious also if I have 2 hooks in one plugin, event data is not the same (pass by reference or reactivity)
|
@Hebilicious I agree with @imcm7 that nitro needs to support async plugins. I have async plugin code that runs at server startup but because nitro does not wait for async plugins to complete, I have a complex race condition that I have to solve to prevent API requests from trying to access the data structures being built by the plugins. |
@robertpatrick I agree. For async plugins you can track the progress here : @imcm7 I think this can be closed now ? |
Environment
Reproduction
https://nitro.unjs.io/guide/plugins#available-hooks
Describe the bug
I have 2 plugins, but second finish first (make more easy task) and I can get in second plugin result from first, event.context is empty in request hook.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: