Firebase cloud function deploy error - HTTP Error: 400, Invalid JSON payload received

Firebase cloud function deploy error - HTTP Error: 400, Invalid JSON payload received

我在我的项目中使用 stripe-firestore-invoices 云函数。我需要自定义它以满足我的用例,所以我没有安装扩展,而是下载了源代码并尝试部署。 但是,send the invoice 的函数(它是一个 firestore 处理函数)没有被部署并抛出以下错误:

!  functions: failed to create function devInvoice-sendInvoice
HTTP Error: 400, Invalid JSON payload received. Unknown name "children" at 'function': Cannot find field.
Invalid JSON payload received. Unknown name "exit" at 'function': Cannot find field.
Invalid JSON payload received. Unknown name "message" at 'function': Cannot find field.

我是运行最新版本firebase-tools:v8.9.0

我尝试将依赖项更新到最新版本:

firebase-functions: v3.11.0
firebase-admin: v9.1.1
stripe:v8.89.0

同样的错误仍然存​​在。

有趣 - 我遇到这个是因为我在做完全相同的事情(仅在我的情况下,使用 firestore-stripe-subscriptions)。

如果您 运行 以下内容,它会提供错误消息的线索:

firebase deploy --only functions --debug

问题是缺少触发器。

奇怪的是,我发现根本原因似乎是 Stripe 源中的一个错误(至少这似乎是阻止我部署的原因...)

从以下位置更改 https 处理程序:

functions.handler.https.onRequest

functions.https.onRequest

为我解决了这个问题。