Search code examples
firebasegoogle-cloud-functionsfirebase-admin

Firebase cloud function cannot read .env variables


I followed this doc and added .env file with variables in a Firebase Cloud Function project.

When trying to deploy, I get this message: Loaded environment variables from .env.

However, it is always undefined when I try to use process.env.ENV_VAR. Am I missing something?

I'm using firebase-cli 11.0.1 and firebase-functions 3.21.2


Solution

  • I used env variables for firebase credentials. Seems like it was loaded before env var. So my solution is to use firebase function config