shadowwalker / next-pwa

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

Uncaught (in promise) bad-precaching-response: bad-precaching-response middleware-manifest.json #291

Closed anonymouscatcher closed 2 years ago

anonymouscatcher commented 3 years ago

Similar to https://github.com/shadowwalker/next-pwa/issues/177 but in next 12 It tries to load _next/server/middleware-manifest.json on client.

anonymouscatcher commented 3 years ago

I tried this but it doesn't work

pwa: {
    disable: isDev,
    dest: 'public',
    reloadOnOnline: false,
    runtimeCaching: defaultCache,
    publicExcludes: ['!middleware*.json']
},
blackroom24 commented 3 years ago

288 is the same issue try looking into it.

n3x7j2 commented 3 years ago

You have the same issue

ciceropablo commented 3 years ago

Same here.

dwfee commented 3 years ago

same here

ksenginew commented 3 years ago

same

JuniYadi commented 3 years ago

try this example: https://github.com/shadowwalker/next-pwa/issues/288#issuecomment-955777098 it's working for me

captain-woof commented 3 years ago

@JuniYadi Thanks, that worked for me!

L1lith commented 3 years ago

None of these fixes worked for me. I'm exporting statically. It would be really nice to be able to use this library.

ksenginew commented 3 years ago

None of these fixes worked for me. I'm exporting statically. It would be really nice to be able to use this library.

@L1lith try this

// next.config.js
const withPWA = require("next-pwa");
const runtimeCaching = require("next-pwa/cache");

module.exports = withPWA({
  pwa: {
    runtimeCaching,
    buildExcludes: [/middleware-manifest\.json$/]
  },
});

This worked for me. Ask me for any help.

L1lith commented 3 years ago

None of these fixes worked for me. I'm exporting statically. It would be really nice to be able to use this library.

@L1lith try this

// next.config.js
const withPWA = require("next-pwa");
const runtimeCaching = require("next-pwa/cache");

module.exports = withPWA({
  pwa: {
    runtimeCaching,
    buildExcludes: [/middleware-manifest\.json$/]
  },
});

This worked for me. Ask me for any help.

I set that config, but when I run it I still can't get the worker to run successfully, now instead of the middleware-manifest.json related error it now says:

Could not load worker TypeError: e.split is not a function
    NextJS 42
        moduleUrl
        $createWorkerFromOldConfig
        l
        createWorker
        $startWorker
        $onChangeMode
        setMode
        loadModule
        setMode
        componentDidMount
        uo
        ku
        unstable_runWithPriority
        Hl
        wu
        ou
        Xl
        unstable_runWithPriority
        Hl
        Xl
        Yl
        cu
        Xu
        hydrate
        be
        be
        e
        l
        _invoke
        S
        j
        a
        C
        C
        fe
        pe
        e
        l
        _invoke
        S
        j
        a8a28b14e-e0bcf10bae6d7a04.js:1:51965

I'm not sure if this is the same issue or not but I'm on Next-PWA@5.4.0 and Next@12.0.3

Edit: I don't know what changed but it's working now for whatever reason

matthewlilley commented 2 years ago

Still appears to be an issue.

shadowwalker commented 2 years ago

Should be working now with latest version and no buildExcludes config needed.

matthewlilley commented 2 years ago

Thanks @shadowwalker! I'll check it out quicky.

priyansharma commented 2 years ago

Please Help, I also get this same issue and I try many way to solve it but nothing is happening issueGit from 2022-07-12 10-47-07

priyansharma commented 2 years ago

My problem is solved after update next-pwa from 5.4.1 to 5.5.4