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.

Leave a Reply

Your email address will not be published. Please enter all fields.

Chullans says:

Hello,

When I contacted WP re this they said it is not possible to write in the root folder as it would jeopardise its security. So I think I am going to delete this plugin.

Anyways thanks and wish you all the best!

Arun Basil Lal says:

Hey there, thanks for checking out SuperPWA!

Sorry to hear your host doesn’t allow that. Simply allowing to write on superpwa-manifest.json and superpwa-sw.js would be good enough, in case you want to negotiate with your host. (The filenames will be different if you are using Multisite btw.)

In any case, we have plans to move to a setup where this will not be necessary. So maybe you can try again later.

Thanks once again for the kind words!

Claudio says:

It would be nice to have the opportunity to create these files inside the plugin or elsewhere and to copy then in the root in a second step.

Arun Basil Lal says:

Starting with SuperPWA 2.0, these files are not written physically and are dynamic instead. Can you upgrade and take a look?

Amitesh says:

Great plugin. However, I could not see it in action. Both the above files did not install. I think you need to sort this issue out with WordPress.com

Arun Basil Lal says:

Hey Amitesh,

Please upgrade to SuperPWA 2.0 and try again. No more physical files, but dynamic files are used instead.

santosh says:

hello,
The files are not get generated ever after the change in permission can you guide what to put in the file so we can create the file manually and upload to the root folder.

Arun Basil Lal says:

Hey Santosh, please upgrade to SuperPWA 2.0 and try again. In this release, these files are not physically written, but are dynamically generated.

James Touchi-Peters says:

Hi: I just installed your plugin – it’s the second PWA plugin I have tried to install – and I got the message back saying the manifest and service worker could not be generated. I got the same error with the previous plugin.

First off, my permissions are fine – I even changed them to 777, and that didn’t help. However, my gut is telling me that I am having this problem because WordPress on my server is not installed in the domain root, but rather in a subdirectory – e,g., https://domain.com/folder/ . I’m guessing that you guys didn’t figure people do these things…

So then, two questions:
1): Where can I hack your plugin to get this to work?; and
2): If I can’t, could I generate and install the manifest and service worker manually?

My thanks in advance for your time and attention —

Arun Basil Lal says:

Hey James, please upgrade to SuperPWA 2.0 and try again. These files are no longer written physically and that should do the trick.

Stay Updated

Learn more about Progressive Web Apps
and get latest updates about SuperPWA

we'll share our root password before we share your email with anyone else.