LoginSignup
0
0

More than 1 year has passed since last update.

Time Zone of Cloud Functions for Firebase Scheduler does not change

Posted at

Time Zone of Cloud Functions for Firebase Scheduler does not change

Problem

I am currently creating and deploying a function to be executed periodically in the Cloud Functions for Firebase scheduler as shown below. The key point is that I want it to be executed every day at 0:05 Japan time as .timeZone('Asia/Tokyo').

The deploy itself is working fine, but when I look at the content in GCP's Cloud Scheduler, the Time Zone is set to (America/LosAngeles) as shown in the image below, and the actual execution time is off from Japan time.

I manually changed the time zone to Japan time in the Cloud Scheduler function management screen and confirmed that the desired behavior was achieved, but when I deploy the function again, it is still set to (America/LosAngeles).

exports.XXX = functions.pubsub
.schedule('every day 0:05')
.timeZone('Asia/Tokyo')
.onRun((context) => {
    /// Codes
});

Solution

It is reported as a bug of firebase-toolsv9.12.0.
https://github.com/firebase/firebase-tools/issues/3425

At the time this issue was reported, the solution was to downgrade to firebase-tools version 9.11.0.
However, 9.12.1 has now been released, and I have confirmed that using the latest 9.12.1 with Node.js version v16(with nvm) solves the above problem.

If you don't know this and deploy the functions, the Time Zone in the scheduler will be set to America, and the app will start running at an unintended time.
This will cause the app to fire at an unintended time, so be careful.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0