2
votes

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).

I thought it might be affected by the region of GCP itself, and that I would have to change the region of GCP, but I haven't found where I can change it from. However, I thought that I should be able to specify the .timeZone for each function from the code. I'm at a loss.

I don't know how to solve this problem, and I'm wondering if anyone can help me.

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

enter image description here

Thank you in advance.

3

3 Answers

3
votes

I have experienced the same problem too. There's also a similar question asked here and the solution to downgrade the firebase-tools works for me.

1
votes

This could be related to your CLI version, Make sure it is updated and if you keep experiencing issues, you should contact firebase support to submit a bug request HERE.

Another solution is that the region could be set as undefined inside your Google Cloud Platform (GCP) resource location. Just be warned that setting the GCP location isn't recommended unless you know what you are doing and you want to set all your default locations.

Reference: default-cloud-location

1
votes

firebaser here

It looks like there is a bug in version 9.12 of firebase-tools that forces all Cloud Functions to be deployed in pacific timezone, regardless of the timezone you set in the code.

Upgrading to version 9.12.1 should fix the problem. For further details on the problem, see this issue on the Github repo.