Ngsw - Degraded due to failed initialization: Failed to retrieve hashed resource from the server

115 Views Asked by At

My angular app with service worker is working as expected locally with offline mode as well. But when i deployed the app, the offline mode is not working. And after each call, i can see one more call made in online mode which is happening all the time. The error i am getting in the ngsw/state is Degraded due to failed initialization: Failed to retrieve hashed resource from the server for the some resources and for the other resources Error:Hash mismatch .

My ngsw-config.json

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js"
        ]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ]

I tried setting the autocrlf false. But it didn't work. I read that hash mismatch may be due to the reason that server may have changed the hash. But is there any suggestion how to resolve that? I couldn't find the first error elsewhere.

I tried changing autocrlf to false.

0

There are 0 best solutions below