1. Home
  2. Troubleshooting
  3. Fixing Manifest and Service Worker Generation Failed Error

Fixing Manifest and Service Worker Generation Failed Error

You are reading this because you saw something like this in your SuperPWA > Settings > Status

Manifest And Service Worker Generation Failed 2.0.1

If not, please upgrade to the latest version of SuperPWA.

Starting with SuperPWA 2.0, manifest and service worker can be either dynamic or static. For dynamic files, a custom permalink is required.

  • Go to WordPress Dashboard > Settings > Permalinks.
  • If “Plain” is selected as the permalink structure, switch to another one.
  • Revisit SuperPWA > Settings and see if the Status has changed.

No luck? Don’t worry, lets try another option.

Are you on NGINX?

If your on NGINX, then you probably have the manifest, but not the service worker. Sometimes both.

This is because, the web server expects to have a static file and doesn’t load WordPress but reports a 404 directly.

Adding the following rewrite rule to the NGINX config file should do the trick. [Thanks]

rewrite ^/superpwa-manifest(-[0-9]+)?.json$ /index.php?superpwa-manifest-$1.json last;
rewrite ^/OneSignalSDKWorker.js.php$ /index.php?OneSignalSDKWorker.js-$1.php last;
rewrite ^/superpwa-sw(-[0-9]+)?.js$ /index.php?superpwa-sw.js last;

Remember:

  • Do not forget to restart the web server after adding the rewrite rules.
  • If this is the first time you are adding a rewrite rule or you do not know where your NGINX config is, please consult with your web host. They will help for sure.
  • Remember to check SuperPWA > Settings > Status to see if everything is good.

No NGINX? No cookie? No problem.

Let’s attempt static files now

SuperPWA generates (or attempts to) two files to convert your WordPress website into a Progressive Web App. You guessed it, the manifest and the service worker.

These files are generated in the root folder of your WordPress install (the same folder where wp-config.php is) during plugin activation.

To generate these files, WordPress needs folder permissions to write to the root folder. In your host however, WordPress couldn’t do it because your web host has limited the permissions on this folder.

Note how I keep saying WordPress needs permissions and not SuperPWA? This is because SuperPWA uses the Filesystem API of WordPress to handle file generation and deletion. So if WordPress can do it, then SuperPWA can do it too.

Fixing file permissions for WordPress

The ideal way to resolve this, is to contact your web host. Tell them what is happening and maybe even point them to this article. They know your server and they will know what to do.

  • They might have to adjust the folder permissions on the root folder to 755 as suggested in the hardening WordPress guide.
  • They also might have to adjust the owner / group of the root folder to the user who runs the process that handles WordPress.
  • Some hosts does not allow writing to the root folder for security reasons. See if that might be the case.

It is a relatively simple fix and should be a very common support request to your web host and they should be able to help you out in no time.

Once the permissions are adjusted, remember to visit SuperPWA > Settings to check the status.

Updated on November 29, 2022

    Are you still looking for a solution?

    Then fill out the below form and we will reach out to you within a few hours.


    Was this article helpful?

    Related Articles

    Need Support?
    Can’t find the answer you’re looking for? Don’t worry we’re here to help!
    Contact Support