You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{onValueCreated}from"firebase-functions/v2/database";import{setGlobalOptions}from"firebase-functions/v2";import{region}from"firebase-functions/v1";setGlobalOptions({region: "europe-west1"});exportconstNewInQueueV1=region("europe-west1").database.ref("mailing/queue/{pushID}/").onCreate(()=>{console.log("There is a new mail in the mailing queue (v1)");});exportconstNewInQueueV2=onValueCreated("mailing/queue/{pushID}/",()=>{console.log("There is a new mail in the mailing queue (v2)");});
[REQUIRED] Steps to reproduce
Create a new project with the default firebase in region europe-west1 and run the firebase functions and database emulators.
Using the emulators ui, import the following json:
making sure the checkbox "Also execute database triggers in the Functions emulator" is checked.
Observe the log.
[REQUIRED] Expected behavior
Both functions should be initialised without warning and on importing the json, both console.log statements should be executed indicating both functions were triggered.
[REQUIRED] Actual behavior
The v2 version warns about functions[europe-west1-NewInQueueV2]: function region is defined outside the database region, will not trigger.. On import, only the v1 functions Is triggered. Even when repeating the setup without the v1 function in index.ts (in case a second function triggering on the same path would be a problem), the v2 function does not get triggered.
// TODO(colerogers): yank/change if RTDB emulator ever supports multiple regions
if (region !== "us-central1") {
this.logger.logLabeled(
"WARN",
`functions[${id}]`,
`function region is defined outside the database region, will not trigger.`,
);
}
Where the comment together with the if clause seems to indicate that regions other than us-central1 are not supported in the emulators. (so I guess this might be interpreted as a feature request instead of an issue?)
Also, the warning message itself is misleading, since it infers the location of the database is wrong, but I believe the message is shown based on the region of the function. In this case, since the region is prepended to the function name, the warning seems to indicate that the referenced database is not in the preferred region europe-west1, when the warning is due to the region of the function, not the database.
The text was updated successfully, but these errors were encountered:
[REQUIRED] Environment info
**firebase-tools:**13.15.4
**Platform:**macOS
[REQUIRED] Test case
index.ts:
[REQUIRED] Steps to reproduce
Create a new project with the default firebase in region
europe-west1
and run the firebase functions and database emulators.Using the emulators ui, import the following json:
making sure the checkbox "Also execute database triggers in the Functions emulator" is checked.
Observe the log.
[REQUIRED] Expected behavior
Both functions should be initialised without warning and on importing the json, both console.log statements should be executed indicating both functions were triggered.
[REQUIRED] Actual behavior
The v2 version warns about
functions[europe-west1-NewInQueueV2]: function region is defined outside the database region, will not trigger.
. On import, only the v1 functions Is triggered. Even when repeating the setup without the v1 function in index.ts (in case a second function triggering on the same path would be a problem), the v2 function does not get triggered.I found the following code:
Where the comment together with the if clause seems to indicate that regions other than
us-central1
are not supported in the emulators. (so I guess this might be interpreted as a feature request instead of an issue?)Also, the warning message itself is misleading, since it infers the location of the database is wrong, but I believe the message is shown based on the region of the function. In this case, since the region is prepended to the function name, the warning seems to indicate that the referenced database is not in the preferred region
europe-west1
, when the warning is due to the region of the function, not the database.The text was updated successfully, but these errors were encountered: