5

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)

Vega
  • 27,856
  • 27
  • 95
  • 103
Karthikeyan Vellingiri
  • 1,270
  • 1
  • 17
  • 26

8 Answers8

6

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> 
Community
  • 1
  • 1
Barnee
  • 3,212
  • 8
  • 41
  • 53
3

I've resolved my issue by this simple steps:

  • go to angular.json in root folder.

  • add src/manifest.json in /assets. If your manifest.json is already in /src folder, otherwise add the path instead.

    "assets": [
        "src/favicon.ico",
        "src/assets",
        "src/manifest.json"
    ],
    
  • restart dev server using ng serve or ng serve -o to open the project

Vega
  • 27,856
  • 27
  • 95
  • 103
AMAL MOHAN N
  • 1,416
  • 2
  • 14
  • 26
2

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... :)

Barnee
  • 3,212
  • 8
  • 41
  • 53
Ehsan Chavoshi
  • 681
  • 6
  • 10
1

Adding the below line in the web.config solved the issue.

<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
 </staticContent>
Karthikeyan Vellingiri
  • 1,270
  • 1
  • 17
  • 26
  • How would including a rule to read .json files work from inside a .json file? The file would be ignored. I believe you mean web.config, as your answer makes no sense as written. – Sean Halls Nov 04 '19 at 04:45
0

in your angular.json

"serviceWorker: true"  

and update

npm install @angular-devkit/build-angular@latest
Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39
0

Make sure your ngsw-config.json configured properly and in your angular.json file, find and change to serviceworker: true.

Also in your angular.json, check if "src/manifest.json", is listed inside "assets" array.

Verify by: https://yourdomain.com/manifest.json is accessible.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Deepak swain
  • 3,380
  • 1
  • 30
  • 26
0

I resolved this issue by adding web.config file in my dist folder

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".webmanifest" mimeType="application/json" />
        </staticContent>
     </system.webServer>
</configuration>
Farman Ameer
  • 1,234
  • 2
  • 16
  • 22
0

As per the other answers, yes you have to add a web.config file, you can just put it inside the dist/(proyect_name)/ folder before deploying and it should work fine.

marmol95
  • 1
  • 1