You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase Functions V2部署时如何保留函数名中的短横线?

Firebase Functions V2 带短横线函数名的部署方法

问题重现

你定义了带短横线的V2版本函数:

exports["processing-file-finished"] = functions.database.onValueWritten(
    {
        instance: this.app.realtimeDatabase,
        ref: "/processing/{fileId}/finished",
    },
    myModule.handleFinish
)

执行部署命令时:

firebase deploy --only functions:processing-file-finished

或

firebase deploy --only functions:processing.file.finished

均收到错误提示:

Function 'processing.file.finished' is not defined in the provided module.

解决方法

问题出在shell会把短横线(-)识别为命令参数的分隔符,导致Firebase CLI无法正确解析带短横线的函数名。只需用引号将函数名部分完整包裹,让shell把整个函数名当作一个整体传递给CLI即可。

正确的部署命令如下:

firebase deploy --only "functions:processing-file-finished"

也可以使用单引号(适配bash、zsh等主流shell):

firebase deploy --only 'functions:processing-file-finished'

执行上述命令后,CLI就能正确识别带短横线的函数名,完成部署。

内容的提问来源于stack exchange,提问作者BąQ

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 14:50:31