【问题标题】:Deployment error. Build failed: Build error details not available. Firebase Cloud Functions部署错误。构建失败:构建错误详细信息不可用。 Firebase 云函数
【发布时间】:2021-05-03 10:09:41
【问题描述】:

我在我的电脑上多次重新安装了NPMNode

(npm 版本 7.4.3)

(节点版本v15.7.0)

我按照以下步骤配置Firebase CLI

npm install -g firebase-tools

firebase initfirebase deploy 和配置似乎工作正常。

当我打开 index.js 文件并取消注释股票 helloWorld 函数时,我面临的问题如下所示:

exports.helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});

我运行 firebase deploy 并收到此错误

functions[helloWorld(us-central1)]: Deployment error.
Build failed: Build error details not available. Please check the logs at https://console.    {urlStuff}


Functions deploy had errors with the following functions:
helloWorld


 To try redeploying those functions, run:
firebase deploy --only "functions:helloWorld"


 To continue deploying other features (such as database), run:
firebase deploy --except functions

 Error: Functions did not deploy properly.

老实说,我现在不知道该怎么办。 我多次尝试重新安装 node 和 npm 并重新执行 Firebase CLI 程序,但似乎没有解决这个问题,我在部署时仍然收到此错误。

我收到的日志错误是这样的:

textPayload: "ERROR: error fetching storage source: generic::unknown: retry budget exhausted (3 attempts): fetching gcs source: unpacking source from gcs: source fetch container exited with non-zero status: 1"

【问题讨论】:

  • 您检查过firebase函数日志中的错误详情吗?
  • 是的,尽管我无法在其中找到任何有用的信息。我现在将它添加到问题的文本中:)
  • 对这个错误没有任何线索。但是得到了一些有用的参考 - stackoverflow.com/questions/64437656/…
  • 兄弟,你救了我,在你链接的问题中,NodeJs 的 2 个版本不匹配,我安装了 15 版时,firebase 使用 12 版运行
  • 很高兴,你成功了!

标签: node.js firebase npm google-cloud-functions


【解决方案1】:

正如@Muthu Thavamani 提供的此链接所建议的那样:

GCP Cloud Function - ERROR fetching storage source during build/deploy

Firebase CLI 使用 NodeJS version 12,而在我的设备上我安装了 version 15

只需使用此guide 来降级您的 NodeJS 版本,一切正常。

【讨论】:

    【解决方案2】:

    对我来说,这是因为我使用的是旧版本的 Firebase CLI。

    所以我按照建议运行了升级命令,并且成功了。

    sudo npm i -g firebase-tools

    (我的Node版本是v15.6.0)

    【讨论】:

      【解决方案3】:

      我遇到了类似的问题,但没有通过更改节点版本来解决。我所要做的实际上是进入 Container Repos 并删除工作人员和缓存图像。然后我让它运行(使用节点 v12.22.1 和 npm v6.14.12)。

      【讨论】:

        【解决方案4】:

        通过使用此命令打开日志检查实际日志,查找和修复问题要容易得多

        firebase functions:log
        

        具体问题将在此处显示。我有时会遇到像 package.json 中缺少包一样简单的错误

        我希望他们可以直接显示有关错误的更好信息。但至少我们可以在这里找到它们。

        【讨论】:

          猜你喜欢
          • 2021-02-06
          • 2020-07-11
          • 2018-10-13
          • 1970-01-01
          • 2022-09-12
          • 2018-09-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多