3

I cannot deploy my firebase cloud functions to specific region. This is my code.

exports.helloWorld1 = functions.region('asia-northeast1').https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
});

exports.helloWorld2 = functions.region('us-central1').https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
});

exports.helloWorld3 = functions.region('europe-west1').https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
});

exports.helloWorld4 = functions.region('us-east1').https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
});

Then I ran deploying the code. This is the result.

enter image description here

How could I define cloud functions' region correctly?

This case is different from use region other than us-central1 for Google Cloud Functions because these functions are deploying on Firebase CLI, not general function executed from gcloud.

#

I found important information.

https://firebase.google.com/docs/functions/locations#http_and_client_callable_functions

Important: If you are using HTTP functions to serve dynamic content for hosting, you must use us-central1.

Kittipat
  • 73
  • 8
  • 1
    What version of the Firebase CLI did you deploy with? Make sure it's the latest and try again. – Michael Bleigh Aug 11 '18 at 01:45
  • Possible duplicate of [use region other than us-central1 for Google Cloud Functions](https://stackoverflow.com/questions/46902502/use-region-other-than-us-central1-for-google-cloud-functions) – Martin Zeitler Aug 11 '18 at 02:14
  • here's also explained, how to migrate existing Cloud Functions in between regions: https://firebase.google.com/docs/functions/manage-functions – Martin Zeitler Aug 11 '18 at 02:15
  • @MichaelBleigh I updated firebase, firebase-admin to the latest version. But the problem is still persist. – Kittipat Aug 11 '18 at 03:17
  • @MartinZeitler I followed them. Not only try changing from one to another regions. But also try specify region at firstly creating a function. Both cases I cannot deploy functions on specific location. – Kittipat Aug 11 '18 at 03:19
  • @Kittipat `functions.region('europe-west1')` defines where the function shall run, not neccessarily where it had been deployed to, in case I understand the documentation correctly. install `firebase-tools` with `npm install -g firebase-tools` if you want to deploy elsewhere. – Martin Zeitler Aug 11 '18 at 03:28
  • Did you previously have versions of helloWorld1 and helloWorld3 that were deployed in the us-central1 region? – Renaud Tarnec Aug 11 '18 at 07:36
  • @RenaudTarnec No, all functions were deployed at first time. And that is all the code for test. I just added const functions = require('firebase-functions'); on the top of code. – Kittipat Aug 11 '18 at 07:41
  • 1
    I'm not sure this may be the reason. https://firebase.google.com/docs/functions/locations#http_and_client_callable_functions "Important: If you are using HTTP functions to serve dynamic content for hosting, you must use us-central1." – Kittipat Aug 11 '18 at 07:45
  • https://stackoverflow.com/questions/51772057/client-callable-firebase-function-fails-when-deployed-to-regions-other-than-us-c – James Poag Aug 11 '18 at 12:50

0 Answers0