AshKeys

Confessions and Confusions of Ashok M A. Personal and Professional Blog.

Ashok Mannolu Arunachalam, FixPWACacheAPIBlog
Back

PWA Fix: Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed

I have recently added Service Worker for this blog in order to make use of the PWA features and offline mode.

Fix

If one of the urls mentioned below returns 404 error, then you get Fix: Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed error.

js
cache.addAll([
'http://unpkg.com/[email protected]/css/tachyons.min.css',
'http://use.fontawesome.com/releases/v5.7.2/css/all.css',
'http://fonts.googleapis.com/css?family=Cookie',
'http://use.fontawesome.com/releases/v5.7.2/webfonts/fa-solid-900.woff2',
'http://use.fontawesome.com/releases/v5.7.2/webfonts/fa-regular-400.woff2',
'http://use.fontawesome.com/releases/v5.7.2/webfonts/fa-brands-400.woff2',
'http://fonts.gstatic.com/s/cookie/v12/syky-y18lb0tSbf9kgqS.woff2'
])

So make sure all of those resources are available properly. Sometimes a typo could mess it up.