next-pwa icon indicating copy to clipboard operation
next-pwa copied to clipboard

No matching service worker detected. You may need to reload the page, or check that the scope of the service worker for the current page encloses the scope and start URL from the manifest.

Open imRHB opened this issue 2 years ago • 5 comments

Hello! I was trying to implement PWA in my portfolio. I got the error when I deployed to Vercel. I like to mention that the PWA is working fine in the localhost

Here is my Chrome dev console. Also, I'm getting the Uncaught (in promise) TypeError: Failed to fetch this error.

Screenshot 2023-04-02 205806

I'm using Next JS (version: ^13.1.1) and next-pwa (version: ^5.6.0)

Here is my next.config.js file

const runtimeCaching = require("next-pwa/cache");

const withPWA = require("next-pwa")({
    dest: "public",
    register: true,
    dynamicStartUrl: false,
    skipWaiting: true,
    runtimeCaching,
    buildExcludes: [
        /middleware-manifest\.json$/,
        /_middleware\.js$/,
        /_middleware\.js\.map$/,
        /middleware-runtime\.js$/,
        /middleware-runtime\.js\.map$/,
    ],
});

const nextConfig = withPWA({
    // next config
    reactStrictMode: true,
    images: {
        remotePatterns: [
            {
                protocol: "https",
                hostname: "i.ibb.co",
                pathname: "/**",
            },
        ],
    },
});

module.exports = nextConfig;

Can anyone help me to get rid of this problem?

imRHB avatar Apr 02 '23 16:04 imRHB

@imRHB It seems this repo is dead and the maintainer cannot be contacted for so long now. I've made an immediate response by resurrecting this repo ImBIOS/next-pwa.

ImBIOS avatar May 02 '23 03:05 ImBIOS

I am facing the same issue but I am using next js 13 app directory. Which, I think is not compatible with next-pwa currently.

nitinTJ avatar May 15 '23 12:05 nitinTJ

I am facing the same issue as well

Haseebshah936 avatar May 15 '23 23:05 Haseebshah936

It's working with the pages directory setup but not with app directory.

nitinTJ avatar May 16 '23 04:05 nitinTJ

I am using a fork of the main repository https://github.com/DuCanhGH/next-pwa this has fixed the registration issue. I am testing it for fallback which I think is not working correctly.

Haseebshah936 avatar May 16 '23 15:05 Haseebshah936