Reputation: 2738
Does anyone know why FUNCTION_REGION environment variable was dropped?
I am trying to deploy functions across regions, each function working with local resources (firestore, other local resources/services).
export const admin = functions
.region("us-central1", "europe-west2")
.https.onRequest(app);
To be able to lookup the right config I need to figure out the current region. Is there any way to get the current region from a firebase function?
How do people do this and why it's not a very common question? What am I missing?
Update: It's FUNCTION_REGION I was looking for not FIREBASE_REGION(not a variable)
Upvotes: 6
Views: 1782
Reputation: 317402
I have never heard of it being populated in the first place, so it might be the case that you were depending on an undocumented implementation detail. The documentation today doesn't suggest anything about the region being available in the environment.
If you have a question about why there was an apparent change, I'd send that question to the Firebase team directly, either through Firebase support or the firebase-talk group.
If you want to detect the region at runtime, the Cloud documentation says that you can use FUNCTION_REGION when targeting the node 8 runtime. It's not clear how best to do that on node 10. Perhaps you can parse it out of the URL the client used to invoke the function.
Upvotes: 3