angular - 为什么调用firebase函数时会出现FCM错误
问题描述
所以我通过AngularFire调用一个firebase函数,如下所示:
const response = await this.aFunctions.httpsCallable<void, ResponseType>('funcName')().toPromise();
这在部署到 firebase(托管)时有效,但在本地环境中(使用ionic serve
),它会引发此错误:
ERROR Error: Uncaught (in promise): FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('http://localhost:8100/firebase-cloud-messaging-push-scope') with script ('http://localhost:8100/firebase-messaging-sw.js'): A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration).
FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('http://localhost:8100/firebase-cloud-messaging-push-scope') with script ('http://localhost:8100/firebase-messaging-sw.js'): A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration).
我在这个项目中没有以任何方式使用 FCM。你知道为什么会这样吗?
解决方案
推荐阅读
- ios - Replaykit stopRecording 显示黑屏 iOS 12
- node.js - Apache + Socket.io 导致在 Mac 上建立 websocket 连接时出错
- c# - 如何区分 DataGridViewComboBoxColumn 单元格单击事件
- python - 在 Jupyter Lab 中预测 python 脚本
- json - 使用 VUE 处理 Json
- scheme - 处理 Scheme script-fu 中的异常
- android - RecyclerView 的 Firebase 查询
- c# - 无法连接,因为目标机器主动拒绝它:IP:80
- javascript - 避免手动重新加载页面?
- python - 我应该如何在数据框中找到也包含 Null 值的数字列?