[英]How to deploy some functions to Cloud Functions for Firebase without affecting some other functions?
当我跑步时
firebase deploy --only functions
它读取index.js
文件并更新从该文件导出的所有函数。 如果在之前的部署中有一个名为a
的 function,而在当前部署中没有这样的 function,则a
将被删除。
换句话说,效果与删除所有现有函数然后添加当前index.js
文件中的所有函数一样。
是否可以添加/更新/删除个别功能?
Firebase CLI 工具 3.8.0 增加了部署特定功能的能力。
firebase deploy --only functions:func1,functions:func2
--only <targets>
only deploy to specified, comma-separated targets (e.g. "hosting,storage"). For functions,
can specify filters with colons to scope function deploys to only those functions (e.g. "--only functions:func1,functions:func2").
When filtering based on export groups (the exported module object keys), use dots to specify group names
(e.g. "--only functions:group1.subgroup1,functions:group2)"
以下方法适用于我部署特定功能而不影响我的其他功能,其中“specificFunctionName”是我想要部署的功能
firebase deploy --only functions:specificFunctionName
火力士在这里
我们最近讨论了部署功能的子集,但目前尚不可用 - 我们也无法给出是否/何时可能的大致情况。
更新自 Firebase CLI 发布以来,部署单一功能的能力是可用的。 见yuku 的回答。
在我尝试@Sergey Mell 在他的评论中提到的内容之前,我从来没有设法让它工作(并且在我的 firebase.json 中没有代码库属性):
firebase deploy --only "functions:func1,functions:func2"
周围的双引号解决了这个问题。
firebase deploy --only "functions:<fileName>.<functionName>"
示例文件夹结构:
functions
node_modules
index.js
smsNotification.js
...
您可以使用以下命令重新部署文件中的函数
firebase deploy --only "functions:smsNotification.sendChatNotif"
您可以使用以下命令重新部署文件中的所有功能
firebase deploy --only "functions:smsNotification"
In case anyone still can't make it work using firebase deploy --only functions:func1,functions:func2
, it's probably because you're probably using codebases, "codebase": "my-codebase"
, in your firebase.json
. 我花了一些时间进行诊断,但在删除该代码库属性后,使用--only
标志仅部署一些功能对我有用
这个给了我丢失的 package。虽然包含了 package,但我不得不重新安装提到的 package。
firebase --debug deploy --only functions:[functionName]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.