Running Cloud Functions locally gives error "functions.config() is not available"

If, like me, you got this error while trying to run your functions locally then it's because functions.config() is only available within the Cloud Functions runtime.

If you are trying to test your functions before you deploy, here is the link to the documentation on how to do so: run functions locally. Specifically, this part is of interest:

If you're using custom functions configuration variables, run the following command in the functions directory of your project before running firebase serve.

firebase functions:config:get > .runtimeconfig.json

However, if you're using Windows PowerShell, replace the above command with:

firebase functions:config:get | ac .runtimeconfig.json

I was running firebase deploy from the wrong dir. Hopefully this will save someone some time.


That does look like you might still have an old version of the firebase CLI, even though you tried to install the newest firebase-tools.

You can check by running firebase --version. That should say at least 3.5.0. If it doesn't, you'll want to run npm install -g firebase-tools again, which should hopefully fix things.

If your firebase --version continues to show the wrong version, you'll want to check if you accidentally have multiple versions of firebase-tools installed.


In my case .runtimeconfig.json / .env / .env.local didn't worked - in any folder.

It turns out that there's some issue with firebase-tools related to PWD on windows.

Before you execute “firebase emulators:start”, run this one:

$env:CLOUD_RUNTIME_CONFIG="$(pwd)/functions/.runtimeconfig.json"