How to fix service worker installation errors

We want your PushEngage WordPress installation should be seamless, but you can still run into issues. The service worker is the key file in collecting push subscribers and sending push campaigns.

We have compiled a guide with various common issues related to the Service Worker file during PushEngage installation and how you can fix these issues.

Before You Start

  • You should avoid redirections; the service-worker.js file should be publically accessible ( If there is any redirection when you try to visit the service-worker.js file, your installation is incorrect, and the subscription will also fail.
  • If you see a 403 or 404 error after attempting to subscribe to your site, something prevents the PushEngage Service worker files from being openly accessible. You can check this by visiting your PushEngage Dashboard or your Browser Console. These files must be written in all capital letters, not as redirects. These pages ought to be accessible to you without any issues.
  • It is necessary to merge service workers if you are integrating PushEngage into a website that already has a service worker (such as a PWA) for PushEngage to function correctly. This guide helps you merge the PushEngage service worker with the existing service worker on your website.

Issues with Service worker and their fixes

Error 1: Incorrect Service Worker file URL

TypeError: Failed to register a ServiceWorker for scope (https://xxxx) with script (https://www). A bad HTTP response code (404) was received when fetching the script.

Solution: Verify that the Service Worker file name and location match the value from your PushEngage dashboard by navigating to Site Settings » Advanced Settings » Service Worker Settings

Error 2: The browser doesn’t have permission to read the Service Worker file

TypeError: Failed to register a ServiceWorker for scope ('https://xxx') with script ('https://xxxx'): A bad HTTP response code (403) was received when fetching the script.

Solution: Check the web server configuration with the web hosting service provider to ensure that the configuration allows reading access to the Service Worker file and that the file is publicly accessible from the internet.

PushEngage team cannot help you with changing permissions only your hosting company or development team can help you fix these permissions.

Error 3: Failed to execute ‘importScripts’

Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope'. The script at (https://xxxxxx) failed to load at (https://www).

Solution:  The Service Worker file uses an incorrect subdomain name in the importScripts ( statement inside the Service Worker file. So, ensure that the importScript statement uses the correct PushEngage subdomain assigned to the site.

The value of the domain query parameter in the Service Worker URL is incorrect. This applies only to sites using the WordPress plugin.

Error 4: Failed to register a Service Worker

DOMException: Failed to register a Service Worker for scope (https://www) with the script (https://xxxxxxxx). The path of the provided scope ('xxx') is not under the max scope allowed ('xxxxxxx'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.

Solution:  Move the service worker file to the root directory and update the service worker path through this guide.
After you have done that, set the value of the HTTP header Service-Worker-Allowed to ‘/’ for requests to the Service Worker file.

If you run into any issues, please contact us by clicking here. Our support team will be able to help you.

Still stuck? How can we help?
Last updated on August 16th, 2023

Engage and Retain Visitors AfterThey’ve Left Your Website

Increase the value of every web visit with Push Notifications that are hard to miss.

  • Forever Free Plan
  • Easy Setup
  • 5 Star Support