firebase - firebase deploy 跳过导出的函数
问题描述
我最近在我的项目中添加了一个新的云功能,但由于某种原因,当我部署它时被跳过:
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';
这就是它变得奇怪的地方 -myTrigger
并anotherTrigger
成功部署,但stripeOperation
没有。没有构建错误。Firebase 没有给我任何关于它为什么被跳过的线索。我检查了一下,转译的代码看起来不错。stripeOperation
是一个可调用函数,但其他 2 个是 firestore 触发器。这是 的签名stripeOperation
:
export const stripeOperation = functions.https.onCall((data, context) => {
...
});
有什么方法可以确定为什么 firebase 不会部署我的功能?我在用"firebase-functions": "^2.3.1"
更新:我尝试重命名该函数,并使用先前部署的函数完全切换函数体,但均未成功。
解决方案
您必须将可调用函数与触发器函数分开导出。这没有意义,所以我提出了一个问题。
functions/src/index
:
export { stripeOperation } from './stripe/stripeOperation';
export { myTrigger, anotherTrigger } from './stripe';
推荐阅读
- google-sheets - 在还必须满足其他条件时计算唯一值
- ruby-on-rails - 将 CROSS JOIN 添加到 Arel
- aws-lambda - 如何仅将我的 AWS lamda 锁定到我的 echo 设备
- c# - 在文本中查找字符串并提取
- python - 如果打开的文件被修改了怎么办?Python
- c++ - 与传统的多态处理相比,使用 std::variant 有什么优势?
- javascript - 可变对象属性行为
- postgresql - 如何在 PostgreSQL 中将列类型从 oid 更改为 bytea
- python - 标记一列中的 ID 第一次出现在另一列中
- javascript - 如何在 Electron 应用程序中实现插件?