Service Worker Keeps Stopping? That's the Contract, Not a Bug
The message in the console is not an error. Service worker registration successful followed by silence is the designed behavior of Manifest V3, and the sooner that stops feeling like a crash, the sooner the bugs get easier. These are the questions I answer most often, in the order they usually arrive. The short version The worker is supposed to stop when idle; that is not a failure. Logs vanish…
The console message "Service worker registration successful" does not indicate an error. Instead, it is the expected behavior of Manifest V3 for a service worker, and a lack of activity is intended. This is usually the first question people ask about service workers. The key points to remember:
1. The service worker stops when idle, which is not considered a failure. Logs disappear because each worker has a fresh console, not due to logging issues.
2. Chrome terminates idle background service workers after around 30 seconds without extension events. A single event can run for up to five minutes, but a pending setTimeout does not count as activity.
3. The worker is primarily a request handler, not a continuously running process.
4. Logs do not persist between worker incarnations as each one starts with a clean console. To track restarts, store a boot marker in storage.
5. The worker disappears after 30 seconds even if the popup is open, as the popup is a separate context. A long-running job that seems like a background job is not considered idle.
6. The worker does not crash often. Opening chrome://serviceworker-internals and checking the lifecycle entries can confirm this.
7. Logs do not disappear because the console is cleared with each worker restart. To keep logs, store them in storage or use a boot marker.
8. The worker does not wake up from timers as they are callbacks in a heap that no longer exists. Alarms can bridge the gap between "later" and "event."
9. To confirm a restart and not a re-run, use a boot ID and sequence number per job.
10. Persist deadlines, job identity, status, and attempt counts, not remaining seconds or interval handles.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.