Ran*_*ku' 60 firebase firebase-tools google-cloud-functions
我跑的时候
firebase deploy --only functions
它读取index.js文件并更新从该文件导出的所有函数.如果在之前的部署中有一个名为的函数a,并且在当前部署中没有这样的函数,a将被删除.
换句话说,效果与删除所有现有函数,然后index.js添加当前文件中的所有函数相同.
是否可以添加/更新/删除单个功能?
Ran*_*ku' 150
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)"
Run Code Online (Sandbox Code Playgroud)
Arj*_*jun 20
以下方式对我来说是一种部署特定功能而不影响其他功能的方法
firebase deploy --only functions:specificFunctionName
Run Code Online (Sandbox Code Playgroud)
Seb*_* F. 12
我从未设法让它工作(并且我的 firebase.json 中没有代码库属性),直到我尝试了 @Sergey Mell 在他的评论中提到的内容:
firebase deploy --only "functions:func1,functions:func2"
Run Code Online (Sandbox Code Playgroud)
周围的双引号解决了这个问题。
firebase deploy --only "functions:<fileName>.<functionName>"
Run Code Online (Sandbox Code Playgroud)
示例文件夹结构:
functions
node_modules
index.js
smsNotification.js
...
Run Code Online (Sandbox Code Playgroud)
您可以仅重新部署文件中的函数
firebase deploy --only "functions:smsNotification.sendChatNotif"
Run Code Online (Sandbox Code Playgroud)
您可以使用以下命令重新部署文件中的所有函数
firebase deploy --only "functions:smsNotification"
Run Code Online (Sandbox Code Playgroud)
小智 5
如果有人仍然无法使用 使其工作firebase deploy --only functions:func1,functions:func2,可能是因为您可能"codebase": "my-codebase"在firebase.json. 我花了一段时间来诊断,但在删除该代码库属性后,使用该--only标志仅部署一些功能对我有用
| 归档时间: |
|
| 查看次数: |
16608 次 |
| 最近记录: |