Firebase 部分部署多个分组功能

问题描述

我正在尝试使用以下命令一次部署多个分组的云功能

firebase deploy --only functions:groupName.functionName,functions:groupName.anotherFunctionName

然而,它只是跳过了这些功能的部署。如果我像这样单独部署它们 firebase deploy --only functions:groupName.functionNamefirebase deploy --only functions:groupName.anotherFunctionName 一个一个地部署。我希望能够在一个命令中完成。

我是不是遗漏了什么,还是这个功能还没有内置?

编辑

我也尝试了以下命令,结果相同:

firebase deploy --only functions:groupName.functionName,groupName.anotherFunctionName

编辑

也许我们的函数functions/index.ts 中的声明方式有所不同:

exports.authentication = require('./authentication')

并在functions/authentication.ts中:


exports.createCustomToken = functions
    .region('europe-west1')
    .https
    .onCall(async (data: any,context: any) => {/*...*/})

exports.anotherFunction= functions
    .region('europe-west1')
    .https
    .onCall(async (data: any,context: any) => {/*...*/})

这将导致命令

firebase deploy --only functions:authentication.createCustomToken,authentication.anotherFunction

解决方法

它不起作用,因为您要在要部署的每个函数之前添加命令的 functions: 部分。

正如您在 documentation 中看到的,要指定组中的每个函数,您只需以 deploy --only functions:groupA.function1,groupB.function4 格式声明它,因此适用于您的情况,如果您使用以下命令应该工作:

firebase deploy --only functions:groupName.functionName,groupName.anotherFunctionName
,

部署属于一个组的多个单一云功能的正确方法是这样的:

firebase deploy --only functions:groupName.functionName,functions:groupName.anotherFunctionName

现在可以在 the official documentation 中找到,正如 Rafael Lemos 在他的帖子中指出的那样。

如果它不适合您,您可能需要重新设置节点环境和 Firebase CLI 工具。使用节点版本管理器 NVM 轻而易举。安装最新的 LTS 版本和 nvm use --lts 以及以下 npm i -g firebase-tools 应该可以解决问题。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...