Firebase的云端函数 - 即使我正在发送Firebase管理功能的出站http请求,也会收到网络错误 [英] Cloud Functions for Firebase - Getting Network error even though I'm making outbound http request for firebase-admin functionality
问题描述
我有一个函数文件,我现在所要做的就是访问Firebase的auth()函数,根据电子邮件检查用户是否存在,然后获取他们的uid。
我有一个Angular 2应用程序,我运行一个http请求来调用该函数,但任何时候我试图运行它,我得到这个错误:
结算帐户未配置。外部网络不可访问,配额受到严重限制。配置结算帐户以删除这些限制
以下是我的代码:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config()。firebase);
$ b / **
*通过电子邮件获取用户的函数
* /
exports.getUserByEmail = functions.https.onRequest((req,res)=> ; {
console.log('req',req);
return admin.auth()。getUserByEmail(req.query.email);
});
这种类型的东西不允许在 预先感谢! 在Spark计划上执行时,会出现所有函数的警告消息。这只是一个警告 - 你可以忽略它,如果你在做自己的任何出站网络。 我们正在考虑更改或删除该消息它不那么令人困惑。 管理员SDK应该可以正常工作。但是,你的函数没有正确地返回一个响应,所以它不会显示任何内容。 HTTP触发器(请阅读这些文档)必须向客户端发送响应以终止一般。他们不会像其他类型的函数一样返回promise。 I have a functions file where all I'm currently trying to do is access the Firebase auth() functionality to check if a user exists, based on email, and then get their uid. I have an Angular 2 app where I run an http request to call that function, but any time I try to run it, I get this error: Here is my code: Is this type of thing not allows on the Thanks in advance! That warning message appears for all functions when executing on the Spark plan. It's just a warning - you can ignore it if you're doing doing any outbound networking in your own own. We're looking into getting that message changed or removed so that it's less confusing. The admin SDK should work fine. However, your function doesn't return an response properly, so it won't appear to do anything. HTTP triggers (please read those docs) must send a response to the client to terminate normally. They don't return promises like the other types of functions. 这篇关于Firebase的云端函数 - 即使我正在发送Firebase管理功能的出站http请求,也会收到网络错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! Spark $ c $计划?我仍然在开发我的应用程序,这是我现在需要的唯一工作,我宁愿不必立即开始使用这个小功能付钱。有什么我可以做的吗?
Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
/**
* Function to get a user by email
*/
exports.getUserByEmail = functions.https.onRequest((req, res) => {
console.log('req', req);
return admin.auth().getUserByEmail(req.query.email);
});
Spark
plan? I'm still in development of my app and this is the only thing I need working right now and I'd rather not have to start paying right away just to use this tiny feature. Is there anything I can do?