Firebase 托管部署错误:任务 5fc ... 失败:6 次尝试后重试用尽 [英] Firebase Hosting Deploy Error: Task 5fc... failed: retries exhausted after 6 attempts

查看:20
本文介绍了Firebase 托管部署错误:任务 5fc ... 失败:6 次尝试后重试用尽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为生产和开发环境设置 2 个全新的 Firebase 项目,其中包括 Firestore、Functions、Storage 和 Hosting.我首先删除对旧 firebase 项目的引用: firebase.json &.firebaserc.然后我运行 $ firebase init 以使用 test Firebase 项目设置托管、函数、存储和 Firestore.然后我使用 $ firebase use --add 设置 Firebase 别名,以便在一个 React.js 项目中的两个项目之间切换.我使用 npm 构建并尝试部署:$ firebase deploy --project:test,但主机不断尝试相同的最后一个文件并失败:Error: Task 5fcd... failed: 6 次后重试用尽..

我已经看到一些与服务器暂时关闭有关的 Stackoverflow 答案,但我没有看到他们这边有任何服务器问题(https://status.firebase.google.com/) 并且这种情况以前一直存在.在我参与的另一个项目中,我试图在同一个 Firebase 项目上部署到 2 个托管目标,但是一个失败了,另一个工作正常,我遇到了同样的错误(我从来没有找到另一个解决方案比不使用多个目标.)

我还可以测试什么才能使其正常工作?它在我的 React.js 代码库中吗?(我最近部署到我过去的项目中)也许这与我的 Firebase 设置过程有关?或者仍然与旧的 Firebase 项目有联系?我不知道下一步该看什么来解决这个问题.任何方向都会很棒,谢谢!

Ps:可能无法连接的奇怪之处在于,如果我只运行 $ firebase deploy,它不会部署 firebaserc 中定义的默认测试环境,而是部署实时测试环境?

.firebaserc:

<代码>{项目":{"default": "test-app-tech","test": "test-app-tech","live": "live-app-tech"}}

firebase.json:

<代码>{火库":{"rules": "firestore.rules",索引":firestore.indexes.json"},职能": {"predeploy": "npm --prefix "$RESOURCE_DIR" 运行构建"},主持":{公共":构建",忽略": ["firebase.json","**/.*",**/node_modules/**"],重写":[{来源": "**",目的地":/index.html"}]},贮存": {规则":存储规则"}}

完整的控制台日志:(不确定比控制台更长的日志文件在哪里)

 === 部署到test-app-tech"...我部署存储,firestore,功能,托管运行命令: npm --prefix "$RESOURCE_DIR" run build>函数@构建 C:UsersmeDocumentsGitHub
eact.app.techfunctions>tsc+ 功能:完成运行预部署脚本.我 firebase.storage:检查 storage.rules 是否存在编译错误...+ firebase.storage: 规则文件 storage.rules 编译成功我 firestore:从 firestore.indexes.json 读取索引...我 cloud.firestore:检查 firestore.rules 是否有编译错误...+ cloud.firestore: 规则文件 firestore.rules 编译成功i 功能:确保启用必要的 API...+ 功能:启用所有必要的 APIi storage: 最新版本的 storage.rules 已经是最新的,跳过上传...我 firestore:上传规则 firestore.rules...+ firestore:在 firestore.indexes.json 中成功部署索引i 函数:准备用于上传的函数目录...i 函数:用于上传的打包函数 (80.39 KB)+ 功能:功能文件夹上传成功我托管[test-app-tech]:开始部署...我托管 [test-app-tech]:在构建中找到 32 个文件⠸ 托管:上传新文件 [0/1] (0%)错误:任务 5fcd5c559ded0c02b3ed7840ca3ee77e95b798730af98d9f18bc627ac898071e 失败:6 次尝试后重试耗尽

解决方案

通过附加 --debug 后缀进行了更深入的探索,这给了我:TypeError [ERR_INVALID_ARG_TYPE]: The "path" 参数必须是字符串类型.接收类型未定义.探索了这个,并试图修复,但没有奏效.我删除了 /node_modules/package-lock.json/build/,重新安装了包,部署了它,它工作了.不确定是什么修复了它,因为我之前删除了这些文件无济于事.我做了一些其他看似无关的小改动,谁知道可能已经连接了,但它现在可以工作了!

更新:我必须真正找到错误,因为我的生产环境有同样的问题,并将其缩小到我探索TypeError [ERR_INVALID_ARG_TYPE] 的步骤.关注这篇文章之后,我有所改变:

托管":{公共":构建",忽略": ["firebase.json","**/.*",**/node_modules/**"],重写":[{来源": "**",目的地":/index.html"}]},

托管":{"公开": "公开",忽略": ["firebase.json","**/.*",**/node_modules/**"],重写":[{来源": "**",目的地":/index.html"}]},

然后部署并通过,但实时服务器上没有显示任何内容,因为它当然没有查看构建文件夹.所以我把它改回指向构建而不是公共,并再次部署并且它起作用了.奇怪的解决方案,发送给 Firebase 团队看看这里到底发生了什么.

I am trying to setup a 2 brand new Firebase projects with Firestore, Functions, Storage, and Hosting for both Production and Development environments. I started with deleting the references to the old firebase project: both firebase.json & .firebaserc. I then ran $ firebase init to setup Hosting, Functions, Storage, and Firestore using the test Firebase project. I then setup Firebase aliases with $ firebase use --add to switch between the two projects within one React.js project. I npm built and am attempting to deploy with: $ firebase deploy --project:test, but the hosting keeps trying the same last file and fails with: Error: Task 5fcd... failed: retries exhausted after 6 attempts..

I've seen some Stackoverflow answers that relate to the servers being down temporarily, but I do not see any server problems on their side (https://status.firebase.google.com/) and this has persisted before. On another project I have worked on, I was trying to deploy to 2 hosting targets on the same Firebase project, but one was failing and the other was working fine, and I was getting this same error (I never found a solution to that other than not using multiple targets.)

What else can I test to get this working? Is it something inside my React.js code base? (I recently deployed to my past project) Maybe it has to do with my Firebase setup process? Or there is still a connection to the old Firebase project? I don't know what to look at next to fix this. Any direction would be great, thanks!

Ps: Something weird that might not be connected is that if I run just $ firebase deploy, it doesn't deploy the default test env defined in firebaserc, but the live test 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"
  }
}

Full console log: (not sure where a longer log file is than just the console)

   === Deploying to 'test-app-tech'...

i  deploying storage, firestore, functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run build

> functions@ build C:UsersmeDocumentsGitHub
eact.app.techfunctions
> 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

解决方案

Explored a bit deeper by appending --debug suffix, which gave me: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined. Explored this, and tried to fix, but didn't work. I deleted /node_modules/, package-lock.json, and /build/, reinstalled packages, deployed and it worked. Not sure what fixed it because I deleted those files before to no avail. I did a few other small, seemingly unrelated changed, which who knows might have been connected, but its working now!

UPDATE: I had to truly find the error with this since my production environment was having the same issue, and narrowed it down to the steps I took exploring the TypeError [ERR_INVALID_ARG_TYPE]. Following this post somewhat, I changed:

"hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },

to

"hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },

then deployed and it went through, but nothing is shown on the live server, because it isn't looking at the build folder of course. So I changed it back to point to build instead of public, and deployed again and it worked. Weird solution, sending to Firebase team to see what really happened here.

这篇关于Firebase 托管部署错误:任务 5fc ... 失败:6 次尝试后重试用尽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆