我试图按照本指南https://firebase.google.com/docs/functions/beta/custom-events添加v2云功能,以处理由firebase条带扩展提供的自定义事件。部署命令似乎运行时没有错误,但是我的新函数没有出现在云控制台中。
我的firebase cli版本是10.2.1。
我使用functionsV2导入const functionsV2 = require("firebase-functions/v2");
我的函数签名是这样的
exports.stripetrialupdated = functionsV2
.eventarc
.onCustomEventPublished(
{
eventType: "com.stripe.v1.customer.subscription.updated",
channel:
"projects/success-academy-5eed2/locations/us-west1/channels/firebase",
region: "us-west1",
},
(event) => {...});
但是,当我尝试使用firebase deploy --only functions
进行部署时,除了这个函数之外,所有函数都会被部署。我的其他函数是HTTP触发器,部署良好,所有函数都位于同一个index.js文件中。没有错误消息,只是这个函数没有出现在deploy命令输出中。同时,运行firebase deploy --only functions:stripetrialupdated
将导致
i deploying functions
Running command: npm --prefix functions run lint
> functions@ lint /Users/gmiao/workspace/success-academy-5eed2/functions
> eslint .
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (82.12 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: cleaning up build files...
✔ Deploy complete!
发布于 2022-07-19 04:01:31
谢谢你的建议,但我最终只是直接处理条形http网络钩子事件,而不是使用事件弧触发器。
https://medium.com/@GaryHarrower/working-with-stripe-webhooks-firebase-cloud-functions-5366c206c6c
发布于 2022-07-11 05:57:57
我仍然不使用版本2,因为它最近已经发布,但可能是因为您正在记录自定义事件,它们不会出现在控制台中,但仍然存在吗?您是否尝试过在某个地方输入console.log (“调用”)?这也许是个愚蠢的问题,但我问你是因为你没有把它写在问题上。另外,在加载函数之后,云函数控制台指示了什么?
https://stackoverflow.com/questions/72931686
复制相似问题