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.
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?
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.
Thanks! we can take two things from this answer: 1) --memory 2) --verbosity arguments as best practice. However that shouldn't fix the issue entirely but can help in understanding the issue. --memory=MEMORY Limit on the amount of memory the function can use. Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB. By default, a new function is limited to 256MB of memory. When deploying an update to an existing function, the function will keep its old memory limit unless you specify this flag. --verbosity=info
--entry-point should be the function you would want to deploy. in the case of this issue should be "process"