程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Cloud Build Trigger - Not in Firebase app directory 错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Cloud Build trigger - Not in Firebase app directory 错误?

开发过程中遇到Cloud Build trigger - Not in Firebase app directory 错误的问题如何解决?下面主要结合日常开发的经验,给出你关于Cloud Build trigger - Not in Firebase app directory 错误的解决方法建议,希望对你解决Cloud Build trigger - Not in Firebase app directory 错误有所启发或帮助;

我在使用 Cloud Build trigger 将 node.Js (Angular) 应用程序从 Bitbucket 存储库部署到 Firebase 时遇到问题。 我执行了本文中的步骤 - https://cloud.google.com/build/docs/deploying-builds/deploy-firebase

  • 开启了必要的 API,
  • 服务帐户拥有所有必需的权限,
  • Firebase 社区构建器已部署并在 Container Registry 中可见,
  • Cloudbuild.Json 文件已添加到存储库中,
  • Cloud Build trigger 已创建,它指向我的代码库的一个特定分支。

问题是在运行 Cloud Build trigger 后,我收到以下错误:“错误:不在 Firebase 应用程序目录中(无法找到 firebase.Json)”

出现这种错误的原因是什么?是否可以指向存储库中 firebase 应用程序和 firebase.Json 文件的触发器?

编辑:
我的 cloudbuild.Json 文件很简单:

{
  "steps": [
   {
      "name": "gcr.io/PROjeCt_name/firebase","args": [
         "deploy","--project","PROjeCt_name","--only","functions"
       ]
  }
  ]
}

登录 Cloud Build 触发器历史记录:

  starTing build "build_ID"

FETCHsourcE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.Google.com/p/link
 * branch            branch_ID -> FETCH_head
head is Now at d8bc2f1 Add cloudbuild.Json file
BUILD
Pulling image: gcr.io/PROjeCT/firebase
Using default tag: latest
latest: Pulling PROjeCT/firebase
1e987daa2432: Already exists
a0edb687a3da: Already exists
6891892cc2ec: Already exists
684eb726ddc5: Already exists
b0af097f0da6: Already exists
154aee36a7da: Already exists
37e5835696f7: Pulling fs layer
62eb6e670f1d: Pulling fs layer
47e62615d9f9: Pulling fs layer
428cea824ccd: Pulling fs layer
765a2c722bf9: Pulling fs layer
b3f5d0a285e3: Pulling fs layer
428cea824ccd: WaiTing
765a2c722bf9: WaiTing
b3f5d0a285e3: WaiTing
47e62615d9f9: Verifying checksum
47e62615d9f9: Download complete
62eb6e670f1d: Verifying checksum
62eb6e670f1d: Download complete
765a2c722bf9: Verifying checksum
765a2c722bf9: Download complete
b3f5d0a285e3: Verifying checksum
b3f5d0a285e3: Download complete
37e5835696f7: Verifying checksum
37e5835696f7: Download complete
428cea824ccd: Verifying checksum
428cea824ccd: Download complete
37e5835696f7: Pull complete
62eb6e670f1d: Pull complete
47e62615d9f9: Pull complete
428cea824ccd: Pull complete
765a2c722bf9: Pull complete
b3f5d0a285e3: Pull complete
Digest: sha256:4b6b7214d6344c8247130bf3f5443a2851e39aed3ececb32dfb2cc25a5c07e44
Status: Downloaded newer image for gcr.io/PROjeCT/firebase:latest
gcr.io/PROjeCT/firebase:latest

Error: Not in a Firebase app directory (Could not locate firebase.Json)
ERROR
ERROR: build step 0 "gcr.io/PROjeCT/firebase" Failed: step exited with non-zero status: 1

Firebase.Json 文件放置在以下路径的存储库中:/apps/firebase/firebase.Json 我看不到在 Cloud Build trigger 配置中指向该路径的任何可能性。

解决方法

我很确定您在运行命令时不在正确的目录中。要检查这一点,您可以添加此步骤

{
  "steps": [
   {
      "name": "gcr.io/cloud-builders/gcloud","entrypoint":"ls"
      "args": ["-la"]
  }
  ]
}

如果您不在正确的目录中,并且您需要在 ./app/firebase 中运行您的部署,您可以在您的步骤中添加此参数

{
  "steps": [
   {
      "name": "gcr.io/PROjeCt_name/firebase","dir": "app/firebase","args": [
         "deploy","--project","PROjeCt_name","--only","functions"
       ]
  }
  ]
}

让我知道它是否更好

大佬总结

以上是大佬教程为你收集整理的Cloud Build Trigger - Not in Firebase app directory 错误全部内容,希望文章能够帮你解决Cloud Build Trigger - Not in Firebase app directory 错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。