Angular service worker fetch error after deploy

Viewed 935

I am using Angular 7 in combination with Angular service worker. But after deploying new application version I get this error for most of times and application runs only after refresh:

The FetchEvent for "https://example.com/runtime.e0d7b28adf942e10148b.js" resulted in a network error response: the promise was rejected.
ngsw-worker.js:589 Uncaught (in promise) Error: Response not Ok (fetchAndCacheOnce): request for https://example.com/runtime.e0d7b28adf942e10148b.js returned response 504 Gateway Timeout
at PrefetchAssetGroup.<anonymous> (ngsw-worker.js:589)
at Generator.next (<anonymous>)
at fulfilled (ngsw-worker.js:312)
runtime.e0d7b28adf942e10148b.js:1 Failed to load resource: net::ERR_FAILED

This is ngsw-config.json configuration:

 "index": "/index.html",
  "assetGroups": [{
    "name": "app",
    "installMode": "prefetch",
    "resources": {
      "files": [
        "/favicon.ico",
        "/index.html",
        "/*.css",
        "/*.js"
      ]
    }
  }, {
    "name": "assets",
    "installMode": "lazy",
    "updateMode": "prefetch",
    "resources": {
      "files": [
        "/assets/**"
      ]
    }
  }]

Currently, HTTP cache is also enabled, could this be causing problems?

0 Answers
Related