3
votes

I am testing the new region settings for Firebase cloud functions something is not right (I may be doing something wrong).

Since our users are in europe i wanted to move all my project and my functions to europe. Https functions are working as expected, just setting this:

export const test = region('europe-west1').https.onRequest(....)

On the other hand, I am having troubles with the firebase triggers. While this function works fine:

export const firebaseUpdateTrigger =  region('us-central1')
.firestore
.document(...)
.onUpdate(...) 

The same code just like this does not get triggered:

export const firebaseUpdateTrigger =  region('europe-west1')
.firestore
.document(...)
.onUpdate(...) 

What is it that I am doing wrong??

I am using these versions:

"firebase-functions": "2.0.4",

"firebase-admin": "5.13.1",

"@google-cloud/firestore": "^0.15.0"

3
Your code doesn't look much like the provided samples. region() is a method of functions that you import from firebase-functions, but it appears like you're just calling it like a regular function, which it is not. firebase.google.com/docs/functions/locations - Doug Stevenson
I have the same problem : When I deployed a Cloud function in europe-west1 region, through functions.region('europe-west1) that is triggered onCreate on firetsore (deployed in europe-west3), the function is never triggered. But when I removed the region specification region('europe-west1), so the function is deployed by default in us-central1 every thing work perfectly. - MBHA Phoenix
I have the issue nomore after I deleted the whole project and recreated a new project again in the europe region. But I cannot asure anybody that it is somehow related, I just say I do not have the issue anymore - Borja Gorriz
Same here. In addition, neither new Europe functions are triggering with firestore triggers. - Alberto Di Gioacchino

3 Answers

2
votes

You might have missed some of the required steps, to change a function's region, namely:

  1. Rename the function, and change its region.
  2. Deploy the renamed function, which results in temporarily running the same code in both regions.
  3. Delete the previous function

You may gather more detail from the "Change a function's region" sub-chapter of the "Manage functions deployment and runtime options" online document.

1
votes

Hey there @Borja Gorriz

I just had a similar issue, this one worked out for me:

exports.onTest2 = functions.region('europe-west2').firestore
    .document('/mycollection/{documentID1}')
    .onUpdate((change, context) => {
      console.log('test all right');
    });

Successful deployment:

screenshot

0
votes

after creating the function with same name I was getting the issue, that the event onCreate is not getting triggered. So, I deleted the old function (in old region) which I don't need. Then I deployed the again. It solved my problem.

  1. deleted the old function
  2. redeployed the new function