There is a Http trigger Cloud function that exec successfully.
Code of function:
Logging with stackdriver:
"Function execution took 301394 ms, finished with status code: 200"
Now, I create a cloud-scheduler to trigger this cloud-function each day at 04:00 am.
Scheduler-Logging with stackdriver:
{
httpRequest: {…}
insertId: "..."
jsonPayload: {
@type: "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished"
jobName: "......"
status: "UNKNOWN"
targetType: "HTTP"
url: "https://...."
}
logName: "...."
receiveTimestamp: "2020-03-02T06:20:36.391816880Z"
resource: {…}
severity: "ERROR"
timestamp: "2020-03-02T06:20:36.391816880Z"
}
I managed to reproduce your issue and it's what I thought, the Cloud Scheduler is not waiting for the response from the Cloud Function. If you have a CF that takes at most 9 minutes to execute, even if you extend the deadline to 9 minutes, this is only on the CF side and the CS will stop waiting, leaving the request's status as UNKNOWN (therefore, FAILED).
If you are creating the CS from the sdk, you should take a look at the parameter --attempt-deadline, which will allow the CS to wait more.
If you don't need to see the response from the CS, you could try using Pub/Sub to start the process without waiting.