Skip to content

node_server preset does not call the close hook on shutdown (regression from v2) #4502

Closed

Description

@schplitt

Environment

nitro 3.0.260610-beta, node 24/26, preset node_server, srvx 0.11.22

Reproduction

Plugin with app.hooks.hook('close', () => console.log('CLOSE HOOK RAN')), then
nitro build + node .output/server/index.mjs and send SIGTERM. Hook never runs.
Under nitro dev + Ctrl+C it does run.

Describe the bug

The close hook never fires on SIGTERM/SIGINT with the node_server preset, so plugin
close handlers (flush, checkpoint, close resources) are silently skipped in production.
Works in nitro dev, which hides it. Worked in v2.

v2 node-server.ts called setupGracefulShutdown(listener, nitroApp)
(runtime/internal/shutdown.ts), whose onShutdown ran callHook('close'). v3
node-server.ts just calls srvx serve(). Shutdown is now srvx's gracefulShutdownPlugin,
which only does server.close() and never touches Nitro hooks. The only v3 callers of
callHook('close') are the dev preset and prerenderer, not node_server.

Activity

  1. added
    bug
    on Sep 2, 2026
  2. added theissue type on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions