Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 7 PWA - Manifest fetch failed (status: 404) at Driver

After deploy my angular 7 project (PWA) got this error. any solution?

Uncaught (in promise) Error: Manifest fetch failed! (status: 404) at Driver. (ngsw-worker.js:2368) at Generator.next () at fulfilled (ngsw-worker.js:1780)

like image 751
Karthikeyan Vellingiri Avatar asked Jul 09 '19 12:07

Karthikeyan Vellingiri


People also ask

What is ng add angular PWA?

Progressive Web Application considers service workers as the primary technology. It allows deep platform integration, such as offline support, background sync, rich caching, and push notifications. The “ng add angular pwa” command generated the ngsw-config.json file, It is solely responsible for service workers.

What happens if a particular file fails validation in angular?

If a particular file fails validation, the Angular service worker attempts to re-fetch the content using a "cache-busting" URL parameter to eliminate the effects of browser or intermediate caching.

How does the angular service worker get updated?

From time to time, the service worker will be updated with bug fixes and feature improvements. The Angular service worker is downloaded when the app is first opened and when the app is accessed after a period of inactivity. If the service worker has changed, the service worker will be updated in the background.

Why does the angular service worker enter safe mode?

An unrelated error causes the service worker to enter safe mode; that is, temporary deactivation. The Angular service worker is aware of which versions are in use at any given moment and it cleans up versions when no tab is using them. Other reasons the Angular service worker might change the version of a running application are normal events:


2 Answers

I had the same problem and I found the solution here.

If you upload a .json file to your Windows Azure website and try to access it, it would give you a 404 File Not Found error because the MIME Type of .json is not set by default. This also applies in general to any file that might need a specific MIME Type.

To fix this issue, FTP into your website and upload the following Web.config file which will set the correct MIME types. If you already have a Web.config file in place, just add the below to the appropriate section.

Web.config:

<?xml version="1.0"?>

<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".json" mimeType="application/json" />
      </staticContent>
   </system.webServer>
</configuration> 
like image 198
Barnee Avatar answered Sep 17 '22 11:09

Barnee


I had a similar issue...

Failed to load manifest.webmanifest . A ServiceWorker passed a promise to FetchEvent.respondWith() that resolved with non-Response value ‘undefined’.

My manifest name was manifest.webmanifest and I had added some filters to my service worker to serve static files only.
Because of .webmanifest extension, it didn't recognize as static content and when the client is offline it failed to serve from cache.

I solved this issue by simply renaming it to manifest.json.

Hope this prevents someone's headache... :)

like image 22
Ehsan Chavoshi Avatar answered Sep 19 '22 11:09

Ehsan Chavoshi