【问题标题】:Deploying cloud functions on cli, "Firebase config variables are not available."在 cli 上部署云函数,“Firebase 配置变量不可用。”
【发布时间】:2018-05-19 19:56:03
【问题描述】:

尝试使用 firebase sdk 配置环境变量。它包含一个将用于谷歌云功能的令牌。

我已按照文档进行操作,但在尝试重新部署云功能时出现此错误。

这些在我的 index.js 文件的顶部

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

这是我的 package.json 文件

{
  "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"
  }
}

如文档中所述,我在尝试运行之前先运行了“firebase deploy --only 函数”...

"gcloud beta 函数部署 myfunction --stage-bucket mybucket --trigger-http"

再次。但我仍然收到此错误。

我的 firebase 工具和所有模块都是最新的,因为我今天才安装它们。

【问题讨论】:

  • 找到解决办法了吗?
  • 很遗憾没有。

标签: firebase google-cloud-platform google-cloud-functions


【解决方案1】:

错误消息抱怨您的 Firebase CLI 版本。

更新到最新版本。在撰写本文时为 3.16.0。

npm update -g firebase-tools

【讨论】:

  • 现在是 3.16.0。我提到一切都是最新的,因为我今天才安装它们。
  • 我现在也遇到了同样的问题,用的是最新版本
  • 我也有同样的问题。
猜你喜欢
  • 2018-07-09
  • 2021-04-21
  • 2019-11-26
  • 2021-05-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多