5

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:

Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions

Here is my code:

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);
});

Is this type of thing not allows on the 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?

Thanks in advance!

AL.
  • 36,815
  • 10
  • 142
  • 281
Stevie Star
  • 2,331
  • 2
  • 28
  • 54
  • Possible duplicate of [Cloud Functions for Firebase - Billing account not configured](https://stackoverflow.com/questions/42784135/cloud-functions-for-firebase-billing-account-not-configured) – Suhaib Jun 22 '17 at 10:12

2 Answers2

19

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 not doing any outbound networking on your 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 a 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.

Michael Mior
  • 28,107
  • 9
  • 89
  • 113
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I hope sending emails isn't considered as outbound networking...? – prompteus Aug 23 '17 at 18:58
  • 1
    @cuddlecheek It depends on the host that's routing the mail. Is it gmail? That's a google destination, and not blocked on the Spark plan. Is it some third party mail server outside of Google? Not allowed on Spark. – Doug Stevenson Aug 23 '17 at 20:56
  • I am making a geo fire calls in my http trigger methods to calculate the distance between two location points. Does this is being considered as outbound networking call ? – Ajay S Sep 01 '17 at 12:13
  • 1
    @TGMCians I believe geofire just makes regular database queries, which should be fine. – Doug Stevenson Sep 01 '17 at 17:47
  • @DougStevenson, Is the Apple push notification service considered as outbound call? I get a problem that app not receive push notification, is it the reason? Thanks – Scofield Tran Sep 26 '17 at 08:44
  • "...you can ignore it if you're doing doing any outbound networking in your own own." Did you mean "if you're NOT doing any outbound networking in your code."? – Michael Mior Nov 14 '17 at 02:23
  • @ScofieldTran Any direct to non-Google services will be blocked outside of Blaze. FCM will not be blocked, however, so you can send messages that way. – Doug Stevenson Nov 14 '17 at 02:56
  • You can filter out that message in the console by clicking the dropdown "All log levels" and choosing "Info". All your logs and errors will still show, but the nag message will go away. – Jack Steam Jun 07 '19 at 21:45
1

to be able to make external requests in firebase cloud functions, you have to choose a plan first. Flame or Blaze plans in console.firebase.google.com