reactjs - 仅本地主机上的 Firebase 托管保留 URL“/__/firebase/init.js”中缺少应用配置 appId
问题描述
我最近开始在 Chrome 中的 Firebase 托管网站的 localhost 版本上看到一个错误:
Uncaught FirebaseError: Installations: Missing App configuration value: "appId" (installations/missing-app-config-values).
我不确定是什么触发了这个。我正在使用 Firebase Hosting Reserved URL 方法来包含 firebase 配置,直到最近才出现问题。
配置是通过<script src="/__/firebase/init.js"></script>
.
这是该 URL 的配置文件:
if (typeof firebase === 'undefined') throw new Error('hosting/init-error: Firebase SDK not detected. You must include it before /__/firebase/init.js');
var firebaseConfig = {
"projectId": "remotesoc...",
"databaseURL": "https://remotesoc...firebaseio.com",
"storageBucket": "remotesoc...appspot.com",
"locationId": "us-central",
"apiKey": "AIzaSyC3K7HT9- ... ",
"authDomain": "remotesoc...firebaseapp.com",
"messagingSenderId": "43697..."
};
if (firebaseConfig) {
firebase.initializeApp(firebaseConfig);
}
如您所见,缺少“appId”值。我几乎可以肯定这曾经在那里。
我已多次构建和部署该应用程序,这被列为确保 Firebase 具有项目的正确配置值的方式。
该应用程序肯定使用了正确的项目,并且在 firebase.json 中引用了托管站点
{
"database": {
"rules": "database.rules.json"
},
"functions": {
"source": "functions"
},
"hosting": {
"site": "remotesoc...",
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}
我曾>firebase init
多次尝试重置 CLI。
部署的站点没有丢失的配置变量,并且运行良好,这仅在 localhost 上。
我可以恢复使用包含的配置文件,但这否定了保留 URL 为您注入值的好处。
任何帮助,将不胜感激。
解决方案
推荐阅读
- android - 使用 AWS 开发工具包的自定义终端节点
- roxygen2 - 软件包“roxygen2”的安装具有非零退出状态
- download - 如何从 jenkins 管道中的 jfrog artifactory 下载或读取工件属性
- amazon-web-services - ELB 健康检查历史/日志
- apache-spark - 在 Java 中为 Spark groupByFunc 传递一个通用编码器
- php - 通过 PHP 存储在数据库中时 HTML 中的选项标记问题
- python - 获取python中“子文件夹”中的json值
- reactjs - 有没有办法获取存储在 api slice [RTK Query] 中的所有响应?
- javascript - 雄辩的 JavaScript:第 4 章
- node.js - node.js 应用程序和 mongo DB 数据库的性能