Firebase 部署失败 - 找不到 functions.yaml。必须使用 http 发现 [关闭]
2023-03-01
4067
我正在尝试部署 Firebase 云功能,但一直收到此错误。最奇怪的是,我之前运行良好,但从 Firebase 对话云视觉切换到 Firebase 对话谷歌文档。突然,出现了这个错误。我尝试了几个不同版本的 Firebase 工具和 NodeJS,但仍然无法修复该问题。以下是错误。
[2023-02-28T17:29:15.917Z] Building nodejs source
[2023-02-28T17:29:15.922Z] Could not find functions.yaml. Must use http discovery
[2023-02-28T17:29:15.935Z] Found firebase-functions binary at 'C:\Users\crisb\source\repos\Javascriptcouldfunction4\functions\node_modules\.bin\firebase-functions'
[2023-02-28T17:29:17.570Z] Serving at port 8704
[2023-02-28T17:29:19.519Z] Got response from /__/functions.yaml Failed to generate manifest from function source: TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received an instance of Object
[2023-02-28T17:29:19.522Z] Failed to parse functions.yamlincomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 83:
... TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of t ...
^ {"name":"YAMLException","reason":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line","mark":{"name":null,"buffer":"Failed to generate manifest from function source: TypeError [ERR_INVALID_ARG_TYPE]: The \"id\" argument must be of type string. Received an instance of Object\n\u0000","position":82,"line":0,"column":82},"message":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 83:\n ... TypeError [ERR_INVALID_ARG_TYPE]: The \"id\" argument must be of t ... \n ^"}
[2023-02-28T17:29:19.528Z] shutdown requested via /__/quitquitquit
Error: Failed to load function definition from source: Failed to generate manifest from function source: TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received an instance of Object
我尝试了几个不同版本的 Firebase 工具和 NodeJS,但仍然无法修复该问题。我从头开始重建了整个项目,但仍然遇到同样的问题。
2个回答
Firebase 用于定义云函数的
functions.yaml
配置文件似乎存在问题。
以下是您可能需要考虑的一些选项:
-
检查
functions
目录是否位于项目中的正确位置。它应该位于项目的根目录中。 -
确保
functions
目录包含必要的文件,包括index.js
、package.json
和functions.yaml
。 -
仔细检查您的
functions.yaml
文件以确保其格式正确。它应该包含每个函数的name
、memory
、timeout
和runtime
字段。 -
如果您使用的是 Firebase CLI,请尝试再次运行
firebase init
命令以重新初始化您的 Firebase 项目。
如果这些修复均不起作用,则可能是 Firebase 存在错误。在这种情况下,您可以尝试联系 Firebase 支持 以获取建议。
Chanpols
2023-03-10
根据我的经验:
如果有人遇到同样的问题,请不要在之前中止项目中的任何内容:
首先检查您的互联网连接,这应该足以将您的文件上传到firebase。
Miftah Classifieds
2023-07-24