-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Environment info
firebase-tools: 7.12.1
Platform: Ubuntu 18.04
Steps to reproduce
- Create a GCP project and enable the organisation policy "constraints/gcp.resourceLocations".
- Ensure that
us-central1is not included in the list of allowed regions. - Try to deploy a cloud function using the firebase tool that is set to use a valid region.
Expected behavior
The function should be deployed.
Actual behavior
The function fails to deploy with the following error:
"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."
}
]
}
]
}
Source
This issue comes from the following lines which hard code the region as us-central1 when generating the upload URL for the cloud functions.
firebase-tools/src/gcp/cloudfunctions.js
Line 275 in 5d06001
| DEFAULT_REGION: "us-central1", |
| var GCP_REGION = gcp.cloudfunctions.DEFAULT_REGION; |
| .generateUploadUrl(context.projectId, GCP_REGION) |