Warm tip: This article is reproduced from stackoverflow.com, please click
gcloud google-cloud-functions google-cloud-platform

google cloud function deploy start failing

发布于 2020-04-20 10:45:30

Startign today, I'm unable to deploy cloud functions using gcloud cli.

Here is my gloud command to deploy cloud function:

gcloud functions deploy chatbot_api_gateway_002_test --runtime python37 --trigger-http --entry-point process --set-env-vars VERIFICATION_TOKEN=sometokenhere,PUBSUB_TOPIC=entrypointfunction001,GOOGLE_CLOUD_PROJECT=cs-be-dev,DEST_URL=__undefined_yet__,DEST_URLS_TIMEOUT=2 --memory=2GB --region=asia-northeast1

I'm getting an error:

Deploying function (may take a while - up to 2 minutes)...failed.

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Build has timed out

I used to work same script 1 hour ago, but now- no one in the team is able to deploy cloud functions and getting the same error.

deployment failed

In the stackdrive logs i see only this:

 {
 insertId: "rr5a8qctoo"  
 logName: "projects/be-dev/logs/cloudaudit.googleapis.com%2Factivity"  

operation: {
  id: "operations/c2F0YWNzLWJlLWRldi9hc2lhLW5vcnRoZWFzdDEvY2hhdGJvdF9hcGlfZ2F0ZXdheV8wMDJfdGVzdC9SMGdpR0ZRWk13aw"   
  last: true   
  producer: "cloudfunctions.googleapis.com"   
 }

protoPayload: {
  @type: "type.googleapis.com/google.cloud.audit.AuditLog"   

authenticationInfo: {
   principalEmail: "myemail@domain.com"    
  }
  methodName: "google.cloud.functions.v1.CloudFunctionsService.CreateFunction"   

requestMetadata: {

destinationAttributes: {
   }

requestAttributes: {
   }
  }
  resourceName: "projects/be-dev/locations/asia-northeast1/functions/chatbot_api_gateway_002_test"   
  serviceName: "cloudfunctions.googleapis.com"   

status: {
   code: 3    
   message: "INVALID_ARGUMENT"    
  }
 }
 receiveTimestamp: "2020-02-05T09:53:42.771914617Z"  

resource: {

labels: {
   function_name: "chatbot_api_gateway_002_test"    
   project_id: "be-dev"    
   region: "asia-northeast1"    
  }
  type: "cloud_function"   
 }
 severity: "ERROR"  
 timestamp: "2020-02-05T09:53:42.153Z"  
}

Any suggestions on how to fix it please?

Questioner
user1503452
Viewed
66
Martin Zeitler 2020-02-05 20:45

It reads message: "INVALID_ARGUMENT" so any of the arguments might be incorrect (the change-log sometimes lists breaking changes). See gcloud functions deploy and compare; for example:

Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB.

Therefore 2GB might eventually be an INVALID_ARGUMENT and (NAME : --region=REGION) also is being declared as a positional argument. Try to get more output with --verbosity=info or debug:

gcloud functions deploy \
    chatbot_api_gateway_002_test \
    --region=asia-northeast1 \
    --runtime python37
    --trigger-http \
    --memory=2048MB \
    --verbosity=info

--entry-point would typically be the directory-name of the function,
eg. helloworld for functions/helloworld/main.py as the entry point.