Firebase Cloud Functions Environment Variables

February 17, 2020

Firebase Cloud Functions

For Firebase Cloud Functions, you can set environment configuration via

firebase functions:config:set nuxtssr.runtime_api_url=""

NOTE: key must be lowercase

NOTE: Run firebase functions:config:get to check existing configurations

To access environment configuration


const config = functions.config();
process.env.RUNTIME_API_URL = config.nuxtssr.runtime_api_url;

To setup environment configuration for local development

Edit functions/.runtimeconfig.json

  "nuxtssr": {
    "runtime_api_url": "http://localhost:5000"

Google Cloud Functions

For Google Cloud Functions, you can set environment variables via

gcloud functions deploy FUNCTION_NAME --set-env-vars RUNTIME_API_URL=""
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.