0
votes

I'm trying to update a cloud function that has been working for over a week now.

But when I try to update the function today, I get BUILD FAILED: BUILD HAS TIMED OUT error

Build fail error

I am using the google cloud console to deploy the python function and not cloud shell. I even tried to make a new copy of the function and that fails too.

Looking at the logs, it says INVALID_ARGUMENT. But I'm just using the console and haven't changed anything apart from the python code in comparison to previous build that I successfully deployed last week.

Error logs

{
 insertId: "fjw53vd2r9o"  
 logName: " my log name "  
 operation: {…}  
 protoPayload: {
  @type: "type.googleapis.com/google.cloud.audit.AuditLog"   
  authenticationInfo: {…}   
  methodName: "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction"   
  requestMetadata: {…}   
  resourceName: " my function name"   
  serviceName: "cloudfunctions.googleapis.com"   
  status: {
   code: 3    
   message: "INVALID_ARGUMENT"    
  }
 }
 receiveTimestamp: "2020-02-05T18:04:18.269557510Z"  
 resource: {…}  
 severity: "ERROR"  
 timestamp: "2020-02-05T18:04:18.241Z"  
}

I even tried to increase the timeout parameter to 540 seconds and I still get the build error.

Timeout parameter setting

Can someone help please ?

1

1 Answers

0
votes

In future, please copy and paste the text from errors and logs rather than reference screenshots; it's easier to parse and it's possibly more permanent.

It's possible that there's an intermittent issue with the service (in your region) that is causing you problems. Does this issue continue?

You may check the status dashboard (there are none for Functions) for service issues:

https://status.cloud.google.com/

I just deployed and updated a Golang Function in us-centrall without issues.

Which language|runtime are you using? Which region?

Are you confident that your updates to the Function are correct?

A more effective albeit dramatic way to test this would be to create a new (temporary) project and try to deploy the function there (possibly to a different region too).

NB The timeout setting applies to the Function's invocations not to the deployment.

Example (using gcloud)

PROJECT=[[YOUR-PROJECT]]
BILLING=[[YOUR-BILLING]]

gcloud projects create ${PROJECT}
gcloud beta billing projects link ${PROJECT} --billing-account=${BILLING}
gcloud services enable cloudfunctions.googleapis.com --project=${PROJECT}

touch function.go go.mod

# Deploy
gcloud functions deploy fred \
--region=us-central1 \
--allow-unauthenticated \
--entry-point=HelloFreddie \
--trigger-http \
--source=${PWD} \
--project=${PROJECT} \
--runtime=go113

# Update
gcloud functions deploy fred \
--region=us-central1 \
--allow-unauthenticated \
--entry-point=HelloFreddie \
--trigger-http \
--source=${PWD} \
--project=${PROJECT} \
--runtime=go113

# Test
curl \
--request GET \
$(\
  gcloud functions describe fred \
  --region=us-central1 \
  --project=${PROJECT} \
  --format="value(httpsTrigger.url)")
Hello Freddie

Logs:

gcloud logging read "resource.type=\"cloud_function\" resource.labels.function_name=\"fred\" resource.labels.region=\"us-central1\" protoPayload.methodName=(\"google.cloud.functions.v1.CloudFunctionsService.CreateFunction\" OR \"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction\")" \
--project=${PROJECT} \
--format="json(protoPayload.methodName,protoPayload.status)"
[
  {
    "protoPayload": {
      "methodName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction"
    }
  },
  {
    "protoPayload": {
      "methodName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction",
      "status": {}
    }
  },
  {
    "protoPayload": {
      "methodName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction"
    }
  },
  {
    "protoPayload": {
      "methodName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction",
      "status": {}
    }
  }
]