Firebase部署会跳过导出的功能

时间:2019-05-31 14:10:31

标签: firebase google-cloud-functions

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

firebase deploy --only functions:stripeOperation

结果

  

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

文件结构如下:

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

functions/src/stripe/index导出stripe文件夹中的所有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"

更新:我尝试重命名该功能,并使用先前部署的功能完全关闭了功能主体,但均无效。

1 个答案:

答案 0 :(得分:0)

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

functions/src/index

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