草庐IT

node.js - Firebase 的云函数错误 : "400, Change of function trigger type or event provider is not allowed"

coder 2023-05-28 原文

当我运行 firebase deploy 时,我收到以下错误消息:

functions: HTTP Error: 400, Change of function trigger type or event provider is not allowed

最佳答案

TL;DR

firebase functions:delete yourFunction // this can be done via the Firebase Console as well
firebase deploy

说明

基本上,Cloud Functions 期望每个函数始终使用相同的触发器,即一旦创建它就必须坚持其原始触发器,因为每个函数名称都连接到特定触发器。因此,触发器只能通过先删除函数然后使用不同的触发器再次创建它来更改。

现在可以使用 functions:delete 命令轻松完成:

firebase functions:delete yourFunction

documentation features more advanced use cases也是。

旧解决方案

解决方案基本上是注释或删除您的函数,然后保存函数文件并进行部署。该函数将在 Firebase 中被删除,但之后您可以插入/取消注释您的函数,它会再次正常部署。当您使用函数并更改它使用的触发器类型(即 HTTP、数据库或身份验证)时,会发生此错误。

先剪掉

/* exports.yourFunction = someTrigger... */

然后,在部署(“firebase deploy”)之后替换您的触发器

exports.yourFunction = anotherTrigger...

关于node.js - Firebase 的云函数错误 : "400, Change of function trigger type or event provider is not allowed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46530361/

有关node.js - Firebase 的云函数错误 : "400, Change of function trigger type or event provider is not allowed"的更多相关文章

随机推荐