🚀

Firebase Functionsがデプロイできない。備忘録#1

に公開

Firebase Functionsがデプロイできない!!!

前回も同じエラーが出たが、どうやって直したか忘れたためもう一度探索。

Build failed with status: FAILURE. Could not build the function due to a missing permission on the build service account. If you didn't revoke that permission explicitly, this could be caused by a change in the organization policies. Please refer to the following documentation for more details and resolution: https://cloud.google.com/functions/docs/troubleshooting#build-service-account.

解決策

前もこれを見た気がする!!
https://stackoverflow.com/questions/79205076/firebase-cloud-functions-missing-permission-on-the-build-service-account
そもそもcomputeアカウントがない!!!!

  • Compute Engine APIを有効化
  • ComputeアカウントにここのURL先のロールなどを付与
  • ログ書き込み
  • 環境とストレージ オブジェクト閲覧者
  • Artifact Registry 書き込み
  • Cloud Build サービス アカウント
  • Cloud Run 起動元などなど

関数に
invoker: 'public', // allUsersに公開(認証は関数内でチェック)
しておくといいかも?

まだエラーがでた...どうやら元のfunctionsが壊れてたっぽい。

firebase functions:delete 関数名 --region region名
firebase deploy --only functions

無事にビルドできた!

Discussion