Open KantiKuijk opened 3 months ago
A workaround is to not set the global region variable when the emulators are running:
if (process.env["FUNCTIONS_EMULATOR"] !== "true") {
setGlobalOptions({ region: "europe-west1" });
}
If you set the region on a function-level, it may be more cumbersome to do so.
This makes the database functions trigger again, however, this will also apply to https functions, changing their URLs.
This also happened in v2 Realtime Database Triggers. When I'm using onValueUpdated
with global region set, it'll print this message in CLI: function region is defined outside the database region, will not trigger.
.
This does not happen in v1 triggers.
[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.