Nitro plugins hooks not working
Hi there, im just looking for help to figure out why my server plugin close hook is not working, not even console logging or anything at all, nothing works. I've attached an image showing im properly using the hook in the defineNitroPlugin wrapper as well, all my code is within it.
16 Replies
Bump
@moderator
don't tag moderators to request help please. thanks
Ok, so how long does it usually take to get a response?
depends a lot on the question
ideally, if you think it is a bug, provide a minimal reproduction and raise an issue
Oh, I'm not sure if it's simple or not, seems it might be a bug or misuse
It's just server plugin that doesn't run anything in close hook when I stop the nitro server
I'd try a plain nitro reproduction and see if it doesn't work there
Okay I'll try that
if it does, raise an issue in Nuxt with a reproduciton (can be as simple as the example here -> https://nitro.unjs.io/guide/plugins#graceful-shutdown)
Plugins - Nitro
Use plugins to extend Nitro's runtime behavior.
if it also doesn't work in nitro, e.g. with the example above, open an issue there 👍
Ok thanks Alex I'll give it a shot
no problem! Best of success 🙏
GitHub
fix(nuxt): call close hook in dev by huang-julien · Pull Request #2...
🔗 Linked issue
resolve #28188
📚 Description
This PR call the close hook when closing the process in dev
This seems like it may be it? And seems they gave up on it
Problem is the close hook doesn't trigger on my digitalocean vps either which is not windows
that should only be in dev mode
It also didn’t work
The issue is that node didn’t call async hooks before exiting.
do you know how to fix it?