1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PWAでFCMプッシュ通知のためのトークンが取得できないときはfirebase-messaging-sw.jsを確認する

Posted at

現象

  • PWAアプリでFCMプッシュ通知のためのtokenが取得できない
  • エラーメッセージが出力されている

エラーメッセージ

A bad HTTP response code (404) was received when fetching the script.

An error occurred while retrieving token.
FirebaseError: Messaging: We are unable to register the default service worker.
Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.
(messaging/failed-service-worker-registration).

原因

  • firebaseでpush通知するために必要なfirebase-messaging-sw.jsが存在しなかった
  • 環境移行中に404になってしまったっぽい
  • 解決してしまえばQiitaに書くほどのことじゃないんだけどねぇ
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?