[A-00160]Google CloudでCloud Functions gen2(第2世代)が使えない場合の対応
Cloud Functions gen2が全く使えない(ひたすらBuild Errorで落ちる)状態を修正した際の対応を記載しておく。
具体的には下記のエラーがひたすら発生するという内容である。
(gcloud.functions.deploy) OperationError: code=13, message=Build failed with status: FAILURE and message: An unexpected error occurred. Refer to build logs: https://console.cloud.google.com/cloud-build/builds;region=asia-northeast1/46ec9c41-28d7-4202-97a0-3e150c4928f2?project=872699352972. For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=asia-northeast1/46ec9c41-28d7-4202-97a0-3e150c4928f2?project=872699352972.
・APIの有効化
下記のコマンドを実行してCloud Functions 2genに必要なAPIを有効化します
gcloud services enable \
artifactregistry.googleapis.com \
cloudfunctions.googleapis.com \
run.googleapis.com \
logging.googleapis.com \
cloudbuild.googleapis.com \
storage.googleapis.com \
pubsub.googleapis.com \
eventarc.googleapis.com
・サービスアカウントの確認
Cloud Functionsを作成、実行するサービスアカウントを確認します。



下記の通り、基本的に操作できるリソースがproject配下全てになっているサービスアカウントであれば問題なくFunctions gen2が作成できると思われる。

残念ながらクリティカルな原因の究明まではできなかった。
一旦新しいプロジェクトを作成して何が原因なのかを一つづつ調べていくのが効果的かと思われる。
一旦はこのような解決方法もあるという意味でこの記事を残しておく。
・Appendix
公式ドキュメントはこちら
https://cloud.google.com/functions/docs/troubleshooting?hl=ja#cloud-sdk
参考文献はこちら
コメントを残す