Reputation: 11070
Error message:
Error: There was an error deploying functions
firebease-debug.log holds this:
[debug] [2021-11-16T12:12:16.165Z] Error: Failed to upsert schedule function lab2 in region europe-west3
function code:
exports.lab2 =
functions
.region('europe-west3')
.pubsub.schedule('*/10 * * * *')
.onRun(lab);
What can I do? Google support leads to stackoverflow, so I post it here. Are there better ways to deal with the Google Cloud problems?
Upvotes: 3
Views: 1087
Reputation: 905
I got the same problem of deploying my schedule functions, and I solved it with a few steps as below:
$ Firebase deploy --only functions:newScheduleABC
NOTE: as @Nicholas mentioned, the Unix Cron Format The GCP accepts has only 5 fields: schedule(* * * * *)
That's it. There should be no problem from now.
You can read more from Manage functions
Upvotes: 0
Reputation: 6518
The reason our schedule function deployment failed was because of the cron job formula. For some reason firebase couldn't understand 0 0 3 1/1 * ? *
, but could understand every 5 minutes
.
It's a shame that firebase doesn't provide a better error message. Error: Failed to upsert schedule function xxx in region xxx
is way too generic.
Upvotes: 1
Reputation: 3597
When you are using scheduled functions in Firebase Functions, an App Engine instance is created that is needed for Cloud Scheduler to work. You can read about it here. During its setup you're prompted to select your project's default Google Cloud Platform (GCP) resource location (if it wasn't already selected when setting up another service).
You are getting that error because there is a difference between the default GCP resource location you specified and the region of your scheduled Cloud Function. If you click on the cogwheel next to project-overview in Firebase you can see where your resources are located. Setting the default GCP resource location same as the scheduler function region, solves the issue.
Upvotes: 2