Yasir
Yasir

Reputation: 2372

Set Firebase local emulator cloud function environment config values

When you update cloud function environment variables, the config values are not accessible when using the local node.js emulator.

On a project with no environment config variables:

There is no mention in the environment config docs but I am assuming it is possible to use the same environment config locally (or a local alternative)?

Upvotes: 28

Views: 11355

Answers (1)

Yasir
Yasir

Reputation: 2372

The answer was in the local emulator documentation.

Note: You can retrieve your production custom configuration variables when emulating functions. However, be cautious when using production config values in local testing of API calls, emails, etc.

To use config variables, run the following command in the functions directory before running firebase serve.

MacOS

firebase functions:config:get > .runtimeconfig.json

Windows

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

Upvotes: 57

Related Questions