CLI工具3.17.0的`firebase deploy`给出“错误:Firebase配置变量不可用”

时间:2018-01-18 19:40:56

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

完整错误转储:

cols10 = [c for c in df10 if c.startswith("m_")]
for param in cols10:
    df10[param] = df10[param].astype(float)

2 个答案:

答案 0 :(得分:10)

使用firebase-tools(Firebase CLI)版本3.17.0,需要使用最新的firebase-functions(版本0.8.1)和firebase-admin(版本5.8.1)SDK。通过从Error: Error occurred while parsing your function triggers. Please ensure you have the latest firebase-functions SDK by running "npm i --save firebase-functions@latest" inside your functions folder. Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function. at init (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/config.js:51:15) at Object.config (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/config.js:29:9) at Object.ref (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/providers/database.js:75:33) at Object.<anonymous> (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/lib/index.js:9:32) at Module._compile (module.js:660:30) at Object.Module._extensions..js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Module.require (module.js:604:17) 文件夹运行此命令来更新它们:

functions

在此之后,部署应该会成功。

编辑:此错误已在CLI版本3.17.1中修复。使用CLI运行模拟器时也会出现类似的错误,并在3.17.3中修复。

答案 1 :(得分:1)

要解决此问题,我需要从firebase功能文件夹的根路径运行:

npm update -g firebase-functions;

再次运行..

npm update -g firebase-functions;

然后根据上述建议更新函数目录中的node_modules

cd functions;
npm install firebase-functions@latest firebase-admin@latest;

注意:有趣的是NPM抱怨两个软件包的安装都无效,即使再次运行安装也是如此。但是,执行firebase deploy --only functions工作得很好。

顺便说一下,对于那些不喜欢在一个大的index.js文件中工作的人来说,我的简单部署快捷方式脚本可能会派上用场:

#!/bin/bash

(cd functions/; cat header.js get*.js process*.js set* > index.js; );

firebase deploy --only functions

say "fire base deploy done";