keploy / keploy/browser-extension
The Service Worker Lifecycle Bug
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 16
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Title: [Bug] Background Service Worker terminates prematurely due to setInterval (Manifest V3)
Description
In src/background/index.js, the extension uses setInterval to continuously poll the Keploy server /health endpoint. Because this extension uses Manifest V3, the background script runs as a Service Worker. Chrome aggressively terminates Service Workers after a short period of inactivity (usually 5 minutes). When the Service Worker sleeps, the setInterval is killed, and the extension silently stops polling and communicating with the Keploy server.
Steps to Reproduce
- Install the extension and load it into Chrome.
- Leave the browser idle for about 5-10 minutes.
- Check the extension's background service worker logs.
- Notice that the polling has stopped because the service worker was suspended.
Expected Behavior
The background script should reliably poll the server or maintain connection regardless of the Service Worker lifecycle.
Proposed Solution
Replace the setInterval logic with the chrome.alarms API, which is explicitly designed to wake up Manifest V3 Service Workers at designated intervals. Alternatively, establish a persistent WebSocket connection.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/background/index.js by tracing the setInterval-based /health polling and review the Manifest V3 service-worker lifecycle behavior. Reproduce the failure by leaving the extension idle for 5–10 minutes and checking the background service worker logs. Done means polling resumes reliably after service-worker suspension; the issue leaves chrome.alarms versus a persistent WebSocket as an unresolved design choice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100