我创建了一个使用此配置库https://www.npmjs.com/package/config的 firebase 函数。当我在本地运行它时,一切正常。
当我尝试部署时,firebase deploy --only functions
函数文件夹中的配置目录和相关文件似乎没有上传。我的函数在尝试读取配置值时失败。
如何告诉 firebase 将我的配置目录与功能一起部署?
更新
文件夹结构是
- 功能
- index.js
- 包.json
- 测试
- index.test.json
- 节点模块
- ...
- 配置
- 默认.json
下面的firebase输出
root@fc19e6bca144:/appfiles# firebase deploy --only functions
=== Deploying to 'familybank'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
Error: Configuration property "dialogflow.intents.welcome_user" is not defined
at Config.get (/appfiles/functions/node_modules/config/lib/config.js:203:11)
at Object.<anonymous> (/appfiles/functions/index.js:39:19)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
at /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:53:3)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
dialogflow.intents.welcome_user
中提供config/defaults.json
,所以我认为它没有上传。