When deploying cloud functions in cli, "Firebase configuration variables are not available."

Trying to set environment variables using firebase sdk. It contains a token that will be used in the google cloud function.

I followed documents in tee and I get this error when I try to redistribute a cloud function.

I have them 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 first ran "firebase deploy --only functions" 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 modules have been updated since I just installed them today.

+4
1

CLI Firebase.

. 3.16.0 .

npm update -g firebase-tools
0

Source: https://habr.com/ru/post/1690303/


All Articles