如何 运行 用于本地开发的 firebase 模拟器,具有功能,远程数据库上的触发器?
How to run firebase emulators for local development with functions, triggers on remote db?
我正在构建一个具有云功能的 firebase API,并希望访问我的生产数据库以进行本地测试。
我的问题:
当我使用
启动我的两个 firebase 模拟器(函数和 firestore)时
firebase emulators:start
1- 我的自定义 API 端点 运行 在 http://localhost:5001 上(有效)
2- 我的触发器到达 http://localhost:8080 上的本地数据库,而我没有设置 FIRESTORE_EMULATOR_HOST=localhost:8080(我想到达我的生产数据库)
或
当我仅使用
启动我的 "functions emulator" 时
firebase emulators:start --only function
...但是我的触发器没有达到,可能是因为这个警告
i functions[userOnCreate]: function ignored because the firestore emulator does not exist or is not running.
另一方面,我正在 localhost:3000
上使用 firebase 运行ning 构建一个 reactjs 应用程序
我使用 firebase SDK 从这个应用调用本地 API。为了访问我的模拟器,我添加了以下行:
firebase.functions.useFunctionsEmulator('http://localhost:5001');
本地模拟器不适用于实际的云托管数据库实例。一切都必须是本地的。
您随时可以file a feature request。
您必须使用 firebase serve
代替 firebase emulators:start
我正在构建一个具有云功能的 firebase API,并希望访问我的生产数据库以进行本地测试。 我的问题:
当我使用
启动我的两个 firebase 模拟器(函数和 firestore)时firebase emulators:start
1- 我的自定义 API 端点 运行 在 http://localhost:5001 上(有效)
2- 我的触发器到达 http://localhost:8080 上的本地数据库,而我没有设置 FIRESTORE_EMULATOR_HOST=localhost:8080(我想到达我的生产数据库)
或
当我仅使用
启动我的 "functions emulator" 时firebase emulators:start --only function
...但是我的触发器没有达到,可能是因为这个警告
i functions[userOnCreate]: function ignored because the firestore emulator does not exist or is not running.
另一方面,我正在 localhost:3000
上使用 firebase 运行ning 构建一个 reactjs 应用程序我使用 firebase SDK 从这个应用调用本地 API。为了访问我的模拟器,我添加了以下行:
firebase.functions.useFunctionsEmulator('http://localhost:5001');
本地模拟器不适用于实际的云托管数据库实例。一切都必须是本地的。
您随时可以file a feature request。
您必须使用 firebase serve
代替 firebase emulators:start