shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.71k stars 312 forks source link

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. #470

Open imRHB opened 1 year ago

imRHB commented 1 year ago

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?

ImBIOS commented 1 year ago

@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.

nitinTJ commented 1 year ago

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.

Haseebshah936 commented 1 year ago

I am facing the same issue as well

nitinTJ commented 1 year ago

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

Haseebshah936 commented 1 year ago

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.