Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Worker Error TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script. #204

Open
hathemi opened this issue Jan 18, 2019 · 0 comments

Comments

@hathemi
Copy link

hathemi commented Jan 18, 2019

i want to connect to my application by phone and save token device in firestore.I run my app on https://192.IP address. I can sign in but token is not added to my firestore. if i run my app on http://localhost, i'am able to save my device token. but not on phone.
this is how i call firebase-messaging-sw.js

window.addEventListener('load', () => {

  if ('serviceWorker' in navigator) {

      navigator.serviceWorker.register('/firebase-messaging-sw.js')
          .then(registration => {

              messaging.useServiceWorker(registration)

              initializePush()
          })
          .catch(err => console.log('Service Worker Error', err))
  }

})
i always get this error.
Service Worker Error TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant