【发布时间】:2021-10-28 07:20:04
【问题描述】:
所以我在本地运行函数时得到了臭名昭著的空函数config() ????
我得到的错误:
It looks like you're trying to access functions.config().stripe but there is no value there. You can learn more about setting up config here: https://firebase.google.com/docs/functions/local-emulator TypeError: Cannot read property 'test_token' of undefined
从functions 文件夹调用以下命令:
firebase emulators:start --only functions
重要信息:
- 我肯定是从函数运行模拟器/服务
- 我做了 firebase 函数:config:get > .runtimeconfig.json 和 验证文件中确实有值
- 我通过 CLI 验证我正在使用正确的 firebase 项目 也可以通过终端调用函数:config:get。
- 当我尝试在本地运行时,我仍然得到一个空的配置文件 使我实际上根本无法运行我的功能(因为它们 依赖这些价值观)
- 这些值肯定是在实际云配置中设置的(这不是一个新项目或任何东西)
firebase 模拟器:启动 --only 函数
我正在使用 firebase 函数版本:3.15.4
顺便说一句,我正在以这种方式访问配置:
import { config, config as firebaseConfig } from 'firebase-functions';
...
const runtimeConfig = config() as CloudRuntimeConfig;
其他想法:
这个项目集成了一些 webpack - 我不确定它是否相关,但只是将它添加到那里,因为它可能是相关的。
请!任何帮助将不胜感激 - 我即将失去它
【问题讨论】:
标签: node.js firebase webpack google-cloud-functions