jonathanpuc
jonathanpuc

Reputation: 179

Deploying cloud functions on cli, "Firebase config variables are not available."

Trying to configure environment variables with firebase sdk. It contains a token which will be used in a google cloud function.

I've followed the docs to a tee and I get this error when I try to redeploy the cloud function.

I've got these at the top of my index.js file

const functions = require("firebase-functions");
const token = functions.config().slack.token;

This is my package.json file

{
  "name": "quincygeorge",
  "version": "1.0.0",
  "description": "smart-office-assistant",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Jonathan Puc",
  "license": "ISC",
  "dependencies": {
    "firebase-admin": "^5.5.1",
    "firebase-functions": "^0.7.3",
    "slack": "^9.1.0"
  }
}

As stated in the docs, I ran "firebase deploy --only functions" first before trying to run...

"gcloud beta functions deploy myfunction --stage-bucket mybucket --trigger-http"

again. But I still get this error.

My firebase tools and all the modules are up to date as I only installed them today.

Upvotes: 4

Views: 415

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317392

The error message is complaining about your version of the Firebase CLI.

Update to the latest version. 3.16.0 at the time of this writing.

npm update -g firebase-tools

Upvotes: 0

Related Questions