serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
272 stars 127 forks source link

Bad deployment bucket location #226

Open Gnucki opened 4 years ago

Gnucki commented 4 years ago

When I deploy my functions, it creates a deployment bucket to us location despite I configured a region in my config :

service: my-service

provider:
  name: google
  runtime: nodejs10
  region: europe-west1
  project: my-project

If a restriction has been made on the deployment regions, an error like this one is produced :

Error: Deployment failed: RESOURCE_ERROR

       {"ResourceType":"storage.v1.bucket","ResourceErrorCode":"412","ResourceErrorMessage":{"code":412,"errors":[{"domain":"global","location":"If-Match","locationType":"header","message":"'us' violates constraint 'constraints/gcp.resourceLocations'","reason":"conditionNotMet"}],"message":"'us' violates constraint 'constraints/gcp.resourceLocations'","statusMessage":"Precondition Failed","requestPath":"https://storage.googleapis.com/storage/v1/b","httpMethod":"POST"}}
      at throwErrorIfDeploymentFails (/home/gnucki/Workspace/top/poc-cqrs/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:71:11)
      at /home/gnucki/Workspace/top/poc-cqrs/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:42:17
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

Even if this error does'nt occur, it seems there is a logic issue here.

Note that it leads, in further deployments, to the error specified in issues https://github.com/serverless/serverless/issues/6820 and https://github.com/serverless/serverless-google-cloudfunctions/issues/217 because the deployment is created in an unstable state because the bucket creation has failed.