Nodejs 20 Firebase functions missing reserved FUNCTION_REGION env var

HELP! My deployed Nodejs 20 Firebase functions used to have a FUNCTION_REGION environment variable available as a default.

This (and other) env var is listed as “reserved” environment variable in the Firebase documentation:

https://firebase.google.com/docs/functions/config-env?gen=2nd#reserved-names

It used to be there! I use it in my application code to determine which regional Firestore database to connect to. It disappeared just recently and I cannot find any documentation or posts that list anyone having a similar issue.

I’ve pored over the docs, the Function YAML, logged process.env, all to no avail. It seems to just have disappeared.

Anyone out there having the same issue?

Hi @nick_booth ,

Welcome to Google Cloud Community!

While Firebase documentation does not explicitly mention why the FUNCTION_REGION is no longer present in your deployed Node.js 20 functions, a few possible reasons might include recent Firebase Functions runtime update may have unintentionally removed or restricted access to FUNCTION_REGION, changes in Firebase Functions v2 could have altered how and when reserved environment variables are injected into function runtime environments, or the variable may now be exposed in a different way or only available in specific execution contexts. You may check this document as a workaround for specifying the region.

If you need more assistance, you may contact Google Cloud Support. They can investigate your specific project and account for any underlying issues. When contacting them, please provide detailed information.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.