我正在尝试为生产和开发环境设置一个2新的Firebase项目,其中包含Firestore、Functions、Storage和主机。我首先删除了对旧的firebase项目的引用:firebase.json
和.firebaserc
。然后我运行$ firebase init
来设置主机、函数、存储和修复,使用test
Firebase项目。然后,我使用$ firebase use --add
设置Firebase别名,以便在一个React.js项目内的两个项目之间切换。I构建并试图使用:$ firebase deploy --project:test
进行部署,但是主机继续尝试相同的最后一个文件,并在:Error: Task 5fcd... failed: retries exhausted after 6 attempts.
中失败。
我看到了一些与服务器暂时停机有关的堆栈溢出答案,但我没有看到服务器端的任何服务器问题(https://status.firebase.google.com/),这一点以前一直存在。在我从事的另一个项目中,我试图部署到同一个Firebase项目中的2个宿主目标上,但其中一个失败了,另一个运行良好,而且我得到了相同的错误(除了不使用多个目标之外,我从未找到其他解决方案)。
我还能测试什么才能让它正常工作呢?这是我的React.js代码库中的东西吗?(我最近部署到我过去的项目),也许这与我的Firebase安装过程有关?还是仍然有一个连接到旧的Firebase项目?我不知道下一步该看什么来解决这个问题。任何方向都会很棒的,谢谢!
Ps:奇怪的是,如果我只运行$ firebase deploy
,它就不会部署在firebaserc中定义的默认测试env,而是动态测试env?
.firebaserc:
{
"projects": {
"default": "test-app-tech",
"test": "test-app-tech",
"live": "live-app-tech"
}
}
firebase.json:
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": "npm --prefix \"$RESOURCE_DIR\" run build"
},
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"storage": {
"rules": "storage.rules"
}
}
完整控制台日志:(不确定比控制台更长的日志文件在哪里)
=== Deploying to 'test-app-tech'...
i deploying storage, firestore, functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build C:\Users\me\Documents\GitHub\react.app.tech\functions
> tsc
+ functions: Finished running predeploy script.
i firebase.storage: checking storage.rules for compilation errors...
+ firebase.storage: rules file storage.rules compiled successfully
i firestore: reading indexes from firestore.indexes.json...
i cloud.firestore: checking firestore.rules for compilation errors...
+ cloud.firestore: rules file firestore.rules compiled successfully
i functions: ensuring necessary APIs are enabled...
+ functions: all necessary APIs are enabled
i storage: latest version of storage.rules already up to date, skipping upload...
i firestore: uploading rules firestore.rules...
+ firestore: deployed indexes in firestore.indexes.json successfully
i functions: preparing functions directory for uploading...
i functions: packaged functions (80.39 KB) for uploading
+ functions: functions folder uploaded successfully
i hosting[test-app-tech]: beginning deploy...
i hosting[test-app-tech]: found 32 files in build
⠸ hosting: uploading new files [0/1] (0%)
Error: Task 5fcd5c559ded0c02b3ed7840ca3ee77e95b798730af98d9f18bc627ac898071e failed: retries exhausted after 6 attempts
发布于 2020-03-17 05:40:29
通过添加--debug
后缀对我进行了更深入的探索,这给了我TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
。探索了这一点,并试图修复,但没有起作用。我删除了/node_modules/
、package-lock.json
和/build/
,重新安装了包,部署并工作了。不知道是什么修正了它,因为我之前删除了那些文件,但没有效果。我做了其他几个小的,看似无关的改变,谁知道可能是连接,但它现在的工作!
更新:我必须找到这个错误,因为我的生产环境也有同样的问题,并且把它缩小到了我探索TypeError [ERR_INVALID_ARG_TYPE]
的步骤。在这个职位之后,我做了一些更改:
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
至
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
然后部署并完成,但是在活动服务器上没有显示任何内容,因为它当然不是在查看构建文件夹。所以我把它改为构建,而不是公共的,然后重新部署,它开始工作了。奇怪的解决方案,发送到Firebase团队,看看这里到底发生了什么。
发布于 2020-12-16 23:34:52
删除.firebase文件夹中的内容并尝试重新部署。
发布于 2021-04-23 05:14:47
发生这种情况有两个原因。
由于互联网速度慢,如果您一次又一次地尝试部署,您将看到在控制台上上传的文件数量减少。这意味着你的文件被上传了,但是它花费了太多的时间,而且你的火力正在耗尽。
https://stackoverflow.com/questions/60699826
复制相似问题