0

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.

  • Hi, welcom to the StackOverflow. It is recommended to provide some code, of what you have already tried to do. Otherwise it's difficult to help you with your issue – mat.hudak Jun 05 '23 at 08:51

0 Answers0