sveltejs / sveltejs/kit

sveltekit:shutdown callback not being called

Open
#13,454 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation pkg:adapter-node
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

I am trying to use the "sveltekit:shutdown" event to close some resources but it doesn't appear that the callback is being invoked when the server is sent SIGINT. The server just stops with the callback never running.

Reproduction

Simple reproduction:

Sveltekit Shutdown

Logs
VITE v6.1.0  ready in 693 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
launching server
registering shutdown hook
initialization complete
user@computer: ~/sveltekitshutdown$
System Info
System:
    OS: Linux 5.15 Linux Mint 21.1 (Vera)
    CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
    Memory: 3.43 GB / 15.56 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.15.4 - ~/.local/share/pnpm/pnpm
  npmPackages:
    svelte: ^5.0.0 => 5.19.10
Severity

annoyance

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked SvelteKit Shutdown reproduction and the sveltekit:shutdown event path, then reproduce the behavior by running the server and sending SIGINT. Done means the registered shutdown callback is invoked so resources can be closed before the server stops.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.