2

I am trying to use Cloud Scheduler to schedule a Cloud Function (HTTP target) on a weekly basis.

Unfortunately, when I try to force a run the function, I get this error:

{
httpRequest: {
status: 500
}
insertId: "op2w2lfi2zmuu"
jsonPayload: {
@type: "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished"
jobName: "projects/my-project-id/locations/us-central1/jobs/my-job-name"
status: "INTERNAL"
targetType: "HTTP"
url: "https://my-http-trigger.a.run.app/"
}
logName: "projects/my-project-id/logs/cloudscheduler.googleapis.com%2Fexecutions"
receiveTimestamp: "2023-05-16T12:37:06.594694219Z"
resource: {
labels: {3}
type: "cloud_scheduler_job"
}
severity: "ERROR"
timestamp: "2023-05-16T12:37:06.594694219Z"
}

Some details about my scheduler job:

  • service account running the job is properly set up and has cloud run invoker role
  • Auth Header is OIDC token
  • Audience is set up as the following: https://my-http-trigger.a.run.app/
  • Ingress Settings of my cloud functions are Allow All Connections

see details the cloud scheduler execution

I was expecting the cloud scheduler run to have a success status (as my cloud function is running without errors) but I got status of last execution = failed

1 Answers1

0

Are you passing data to the cloud function from the Cloud Scheduler body? I was getting the same error and what I had to do was to change in the Cloud Scheduler the 'content-type' to 'application/json' as before it was 'application/octet-stream'. Now the data passed successfully and the cloud function ran.

For ferHTTP Triggering Cloud Function with Cloud Scheduler

Veselin
  • 43
  • 1
  • 7