Immutable solution version
Airship web push duplicates after moving the service worker
Complete solution
Shows how to fix airship web push duplicates after moving the service worker. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Browsers detect the change and kill the stale subscription tied to the old location, which is what was doubling the notifications. Keep service worker locations stable, and when you must move one, always leave the cleanup file behind.
Steps
- If Airship web push starts duplicating after you move the service worker, do not resubscribe everyone: drop a cleanup push-worker.js at the worker's previous location that unsubscribes on activate. Browsers detect the change and kill the stale subscription tied to the old location, which is what was doubling the notifications. Keep service worker locations stable, and when you must move one, always leave the cleanup file behind.
When to use
You are seeing this: If Airship web push starts duplicating after you move the service worker, do not resubscribe everyone: drop a cleanup push-worker.js at the worker's previous location that unsubscribes on activate. Use this skill when you run into "Airship web push duplicates after moving the service worker".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Source: Airship's official Web SDK getting-started docs carry a troubleshooting section on duplicate web notifications: if the push service worker is moved, for example from a non-root location to the root directory, users get duplicate notifications. This happens because push subscriptions are tied to the service worker's location, and a browser-cached worker at the old location keeps running alongside the new registration, which creates a new channel ID. Airship's documented fix is to place a cleanup push-worker.js at the old location whose activate handler unsubscribes the stale subscription.
Verified resolution: If Airship web push starts duplicating after you move the service worker, do not resubscribe everyone: drop a cleanup push-worker.js at the worker's previous location that unsubscribes on activate. Browsers detect the change and kill the stale subscription tied to the old location, which is what was doubling the notifications. Keep service worker locations stable, and when you must move one, always leave the cleanup file behind.
Source URL: https://www.airship.com/docs/developer/sdk-integration/web/getting-started/
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl__5zH-bf_tPhh4Zbsrghj2Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Airship web push duplicates after moving the service worker <span>— Vectle</span></a>