简体   繁体   中英

Google Firebase Functions deployment fails - what can I do?

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?

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 *? * 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.

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.

I got the same problem of deploying my schedule functions, and I solved it with a few steps as below:

  • Step 1: Rename the schedule function (for example: newScheduleABC), then only deploy it:

$ 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM