Firebase Service worker not found while using GWT (404 Error)

Just create an empty file in root folder firebase-messaging-sw.js


The Firebase SDK attempts to register the service worker at a specific location.

The location is + /firebase-messaging-sw.js. There are two options:

1.) Make + /firebase-messaging-sw.js work in the browser (i.e. make sure it returns a valid response) and then try using the SDK again (it should work if the browser can access the file).

2.) Use the useServiceworker(<service worker registration>) method to pass in a custom service worker. This will still require you to have a valid service worker URL.