Karthikeyan Vellingiri
Karthikeyan Vellingiri

Reputation: 1330

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)

Upvotes: 7

Views: 10679

Answers (8)

marmol95
marmol95

Reputation: 1

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.

Upvotes: 0

Farman Ameer
Farman Ameer

Reputation: 1462

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>

Upvotes: 1

AMAL MOHAN N
AMAL MOHAN N

Reputation: 1622

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

Upvotes: 4

Deepak swain
Deepak swain

Reputation: 3694

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.

Upvotes: 0

Ehsan Chavoshi
Ehsan Chavoshi

Reputation: 725

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

Upvotes: 2

Karthikeyan Vellingiri
Karthikeyan Vellingiri

Reputation: 1330

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

<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
 </staticContent>

Upvotes: 1

Barnee
Barnee

Reputation: 3389

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> 

Upvotes: 6

Chanaka Weerasinghe
Chanaka Weerasinghe

Reputation: 5742

in your angular.json

"serviceWorker: true"  

and update

npm install @angular-devkit/build-angular@latest

Upvotes: 0

Related Questions