firebase / quickstart-js

Firebase Quickstart Samples for Web
https://firebase.google.com
Apache License 2.0
5.03k stars 3.66k forks source link

Including service worker file "firebase-messaging-sw.js" #440

Open dmantelli opened 4 years ago

dmantelli commented 4 years ago

Hi guys!.

I have a very real strange issue. When I deploy my project to a firebase hosting i've not problem. But when I deploy de SAME EXACT code in my public server i got the famous error code:

If I try to open the file in the firebase hosting, it opens succesfully: https://XXXXX.firebaseapp.com/firebase-messaging-sw.js

But when I try to open in my public server, automatically redirects to the login page and it seems the file doesnt exist.

image

In my angular.json i have this:

image

The file existis in my src folder:

image

And when i run ng build --prod the file appears in the dist folder:

image

I dont know what to do !. Can anyone help me?

Thanks (sorry my english, i speak spanish)

morgadorodolfo commented 4 years ago

Hi,

I had the same problem.

See if this helps:

in angular.json file add "src/firebase-messaging-sw.js"

        "assets": [
          "src/favicon.ico",
          "src/assets",
          "src/firebase-messaging-sw.js"
        ],

Hope it helps as it did in my case.

Stay safe!

Rodolfo