Cloud Functions 作成時の組織ポリシー エラー

Cloud Functions 作成時の組織ポリシー エラー

「hello world」Cloud Function を作成しようとすると、次のエラー メッセージが表示されます。

「リクエストは 1 つ以上の組織ポリシーに違反しています。詳細については、それぞれの違反を参照してください。」

さて、どの組織ポリシーに違反したのでしょうか? ログ エクスプローラーでは、次のようなエラー メッセージが見つかります。

{
insertId: "XXX"
logName: "projects/XXX/logs/cloudaudit.googleapis.com%2Factivity"
protoPayload: {10}
receiveTimestamp: "2021-11-26T11:42:16.735011108Z"
resource: {2}
severity: "ERROR"
timestamp: "2021-11-26T11:42:16.490247Z"
}

答え1

私は自分の問題の解決策を見つけました: 「関数の作成」をクリックした後、「実行時、ビルド、接続、およびセキュリティ設定」 -> 「接続」を選択し、オプションを選択する必要がありました。

そこではオプションが選択されていませんでした。これはプロジェクトのネットワーク設定によるものだと思います。

これでデプロイできます:)

答え2

ログには詳細が記録されますエラー.詳細[x].違反[x].タイプログ エントリには、違反している制約が示されています。

次のログ エントリは、場所の違反を示しています。

"type": "constraints/gcp.resourceLocations"

ログエントリの例:

"error": {
  "code": 400,
  "message": "The request has violated one or more Org Policies. Please refer to the respective violations for more information."
  "status": "FAILED_PRECONDITION" 
  "details\": [
    {
      "@type": "type.googleapis.com/google.rpc.PreconditionFailure",
      "violations": [
        {
          "type": "constraints/gcp.resourceLocations",
          "subject": "orgpolicy:projects/<project>",
          "description": "Constraint constraints/gcp.resourceLocations violated for projects/<project> attempting GenerateUploadUrlActionV1 with location set to us-central1. See https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints for more information."
        }
      ]
    }
  ]
}

組織ポリシーの制約

関連情報