Firebase函数模拟器useFunctionsEmulator()方法不起作用 [英] firebase functions emulator useFunctionsEmulator() method not working

查看:283
本文介绍了Firebase函数模拟器useFunctionsEmulator()方法不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在努力在本地测试我的云功能. 我发现了几种方法,但是使用Firebase模拟器和useFunctionsEmulator()方法似乎很棒.在 https://firebase.google.com/docs/functions/local-emulator,但他们并未提及该方法,但我在此网址

I am currently working on the way to test my cloud functions locally. I found several ways but using firebase emulator and useFunctionsEmulator() method seemed great. At https://firebase.google.com/docs/functions/local-emulator, they didn't say about the method, but I found it on this url How to test `functions.https.onCall` firebase cloud functions locally?.

但是,当我运行firebase模拟器时:start和console.log(firebase.functions().useFunctionsEmulator(' http://localhost :5001 '),它只是显示为未定义.

However, when I run firebase emulator:start and console.log(firebase.functions().useFunctionsEmulator('http://localhost:5001'), it just showed undefined.

我尝试了几个关于原点的输入,但是没有改变.互联网上关于此的信息很少,我认为这是因为它是Alpha,所以请对此提供帮助.

I tried several inputs on the origin but nothing changed. There's so little information on the internet about this, I think that's because this is alpha, so Please help me on this.

推荐答案

在客户端中初始化Firebase应用之后,我通过调用useFunctionsEmulator()方法使模拟器工作并处理本地请求.事先调用它会导致错误.

I got the emulators working and handling local requests by calling the useFunctionsEmulator() method just after initializing the firebase app in the client. Calling it prior caused errors.

firebase.initializeApp(config);
firebase.functions().useFunctionsEmulator("http://localhost:5001");

这篇关于Firebase函数模拟器useFunctionsEmulator()方法不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆