本文介绍了在Firebase Cloud Functions中仅部署单个非导出功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Firebase云函数的文件中创建了以下函数:

I have created the following function in my the file of my firebase cloud functions:

function whatsMyName(name) {
  return "your name is " + name
}

当我运行以下命令时在命令行中,然后部署功能

When I run the following in the command line, then the function is deployed:

firebase deploy --only functions

但是,这部署了我所有功能的 all 。我只想部署 whatsMyName 函数。通常,如果我有一个导出的函数,像这样:

But, this deploys all of my functions. I would like to only deploy the whatsMyName function. Typically, if I have a function that is exported, like so:

exports.someExportedFunction = functions.https.onRequest((req, res) => {
   // do some stuff
}

然后,我可以运行以下命令来部署导出的函数:

Then I can run the following to deploy the exported function:

firebase deploy --only functions:someExportedFunction

但是,当我运行以下命令时,未部署非导出功能:

However, when I run the following, the non-exported function is not deployed:

firebase deploy --only functions:whatsMyName

有没有人理解为什么这不能单独部署我的非导出功能 whatsMyName ,以及如何为Firebase Cloud Functions部署非导出功能? / strong>

Does anyone understand why this doesn't individually deploy my non-exported function, whatsMyName, and how to deploy a non-exported function for Firebase Cloud Functions?

推荐答案

CLI只能单独部署导出的函数触发器。不是专门部署任何任意的JavaScript命名函数。

The CLI can only individually deploy exported function triggers. It can not specifically deploy any arbitrary JavaScript named function.

换句话说,您目前无法执行的操作。

In other words, what you're trying to do is not currently possible.

这篇关于在Firebase Cloud Functions中仅部署单个非导出功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 10:48