Home > database >  How to change default region in Google Cloud Console?
How to change default region in Google Cloud Console?

Time:10-01

I'm trying to change default region for cloud functions. Client side I've changed like this:

const firebaseFunctions = require("firebase-functions");
const functions = firebaseFunctions.region("europe-west3");

And now when I deploy I can see the correct region. But when I go to the logs in Google Cloud I see 2 hours less so the scheduler doesn't trigger my function.

In the documentation I read that you can get and change the default region from Google Cloud Console. This is my console:

****@cloudshell:~ (*****)$ gcloud config set functions/region europe-west3
Updated property [functions/region].
****@cloudshell:~ (project)$ gcloud config get-value compute/region
Your active configuration is: [cloudshell-*****]
europe-west3 

Could be a propagation problem? Or am I missing something?

[EDIT] The function triggers like this:

functions.pubsub.schedule('0 6 * * *').onRun(async (context) => {
...
}

What I expect: function is triggered at 6:00 AM

CodePudding user response:

Can you explain|show your issue with Cloud Logging?

You are correct that you can select the region for the Firebase function using .region("europe-west3"). This will deploy the function to that region.

However, gcloud is a separate command and using gcloud config only applies to subsequent gcloud commands; you're not using gcloud and so won't be affected by that change.

CodePudding user response:

[SOLVED] The default region was already changed, but the region of my function in Cloud Scheduler was not. To change it:

  1. Go to Firebase-> Functions
  2. Open options for your function and press "Open in Cloud Scheduler"
  3. In Cloud Scheduler select your function and press "Edit"
  4. Choose the timezone you prefer

Maybe is not the best practice, but it works. If you know a better way to do it please leave answer

  • Related