【问题标题】:firebase deploy skips exported functionfirebase deploy 跳过导出的函数
【发布时间】:2019-10-17 04:45:17
【问题描述】:

我最近在我的项目中添加了一个新的云功能,但由于某种原因,我在部署时跳过了它:

firebase deploy --only functions:stripeOperation

导致

⚠ 功能:指定了以下过滤器但不匹配 项目中的任何函数:stripeOperation

文件结构是这样的:

functions/
├── src/
│   ├── stripe
│   │    ├── index.ts
│   │    ├── myTrigger.ts
│   │    ├── anotherTrigger.ts
│   │    └── stripeOperation.ts
│   ├── index.ts

functions/src/stripe/index 导出条带文件夹中的所有 3 个函数。 functions/src/index 将它们从条带文件夹中导出:

export { stripeOperation, myTrigger, anotherTrigger } from './stripe';

这就是奇怪的地方 - myTriggeranotherTrigger 成功部署,但 stripeOperation 没有。没有构建错误。 Firebase 没有给我任何关于它为什么被跳过的线索。我检查了一下,转译的代码看起来不错。 stripeOperation 是一个可调用函数,但另外两个是 firestore 触发器。这是stripeOperation的签名:

export const stripeOperation = functions.https.onCall((data, context) => {
  ...
});

有什么方法可以确定为什么 firebase 不会部署我的功能?我正在使用"firebase-functions": "^2.3.1"

更新:我尝试重命名函数,并用之前部署的函数完全切换函数体,但都没有成功。

【问题讨论】:

  • 您也可以在问题中添加stripeOperation 的签名吗?我怀疑它真的会有所不同,但想确定一下。
  • 我更新了我的示例以包含stripeOperation的签名

标签: firebase google-cloud-functions


【解决方案1】:

您必须将可调用函数与触发器函数分开导出。这没有意义,所以我filed an issue

functions/src/index:

export { stripeOperation } from './stripe/stripeOperation';
export { myTrigger, anotherTrigger } from './stripe';

【讨论】:

    猜你喜欢
    • 2017-08-02
    • 2020-03-19
    • 2020-12-28
    • 2019-07-01
    • 2019-05-08
    • 2019-02-07
    • 1970-01-01
    • 2018-10-12
    相关资源
    最近更新 更多