Home > Back-end >  I want to set region for Firebase Functions in nodeJS project
I want to set region for Firebase Functions in nodeJS project

Time:10-16

While creating a project, I selected the region asia-south1, but I am surprised when I deploy the functions URL started from us-central1

I want to know, What is the current region for my firebase function, I want to set it as asia-south1.

Any help will be appreciable.

Thanks.

CodePudding user response:

You can find how to change a GCF region in the Firebase documentation:

By default, functions run in the us-central1 region. Note that this may be different from the region of an event source, such as a Cloud Storage bucket. If you need to change the region where a function runs, follow the recommendations in this section for each function trigger type.

To set the region where a function runs, set the region parameter in the function definition as shown:

exports.myStorageFunction = functions
    .region('asia-south1')
    .storage
    .object()
    .onFinalize((object) => {
      // ...
    });

You can specify multiple regions by passing multiple comma-separated region strings in functions.region().

  • Related