Next-pwa: Service worker is not registering and has status redundant

Created on 25 Jan 2021  路  5Comments  路  Source: shadowwalker/next-pwa

Summary

On my blog I can't get the service worker working. The status in the developer tools shows as redundant.

https://nextjs-blog-git-pwa.marcofranssen.vercel.app/

How To Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://nextjs-blog-git-pwa.marcofranssen.vercel.app/'
  2. Open developer tools
  3. Click the 'Application' tab.
  4. See status
  5. See the console for errors

Link to minimal reproduce setup repository if any.

My next.js config looks as following.

const withPWA = require("next-pwa");

module.exports = withPWA({
  async rewrites() {
    return [
      {
        source: "/sitemap.xml",
        destination: "/api/sitemap.xml",
      },
      {
        source: "/blog-sitemap.xml",
        destination: "/api/blog-sitemap.xml",
      },
      {
        source: "/page-sitemap.xml",
        destination: "/api/page-sitemap.xml",
      },
      {
        source: "/category-sitemap.xml",
        destination: "/api/category-sitemap.xml",
      },
      {
        source: "/tag-sitemap.xml",
        destination: "/api/tag-sitemap.xml",
      },
      {
        source: "/atom.xml",
        destination: "/api/atom.xml",
      },
    ];
  },
  pwa: {
    dest: "public",
  },
});

Expected Behaviors

The service worker registers properly and does not log any errors.

Screenshots

N.A.

Additional Context

N.A.

bug

Most helpful comment

I figured out it was cause by the plugin adblock plus. Since I removed that plugin from my browser all works.

All 5 comments

I have tried in Firefox and there I can see from the application panel that it works properly. My Google Chrome however keeps in this error state.

https://github.com/GoogleChrome/workbox/issues/1819 seems also here is a related issue. Not sure how to solve though. Might be caused by some of the rules next-pwa is putting in place.

150 might enable us to properly debug in this production build.

When this has come up in the past, it has tended to be due to a Chrome Extension that blocks content downloads. If there's something in your precache manifest that's blocked by an extension, the service worker will never complete installation鈥攅very entry in the manifest needs to be cached to consider installation a success.

I visiting your site in Chrome and the service worker installed successfully. What happens if you try it yourself in an Incognito window, with Extensions disabled?

@jeffposnick you are right. In Incognito it works, but what I don't get is why I don't have the error when running on localhost. On localhost I run exactly the same code.

I figured out it was cause by the plugin adblock plus. Since I removed that plugin from my browser all works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonahsnider picture jonahsnider  路  4Comments

flamedmg picture flamedmg  路  4Comments

maximousblk picture maximousblk  路  7Comments

panjiesw picture panjiesw  路  7Comments

rrjanbiah picture rrjanbiah  路  6Comments