Questions tagged [firebase-admin]

The Firebase Admin SDK is a set of client libraries which enable App Developers to write more custom behavior for their apps by providing server technologies access to Firebase APIs. Currently, there are libraries for Node.js, Java, Python and Go.

Firebase Admin SDK grants elevated privileges on the server-side, to features like:

  • Firebase Database (Realtime Database and Cloud Firestore)
  • Firebase Authentication
  • Firebase Storage
  • Firebase Cloud Messaging
2205 questions
17
votes
4 answers

Cloud function to export Firestore backup data. Using firebase-admin or @google-cloud/firestore?

I'm currently trying to build a cloud function to export my Firestore data to my Storage Bucket. The only example I've found on the Firebase DOCs on how to do…
17
votes
3 answers

Firebase Cloud Functions : Failed to read credentials from file

Due to new Firebase Cloud Functions (version > 1.0). I only need to call admin.initializeApp(); Without any parameters. However when I did like that then run firebase deploy --only functions , this error occurred : Failed to read credentials from…
user38931
  • 471
  • 1
  • 6
  • 16
17
votes
2 answers

How to authenticate a firebase user from server without client side auth?

I have an API which uses the node admin sdk to connect and call to firebase. My clients hit my api for all the things they need. I do not want them to have to call out to firebase to authenticate directly because I want the client code decoupled…
Brian
  • 435
  • 1
  • 5
  • 10
16
votes
3 answers

initializeApp when adding firebase to app and to server

I'm using firebase for auth and db, and AWS lambda for cloud functions. To add firebase to my JS project, I initializeApp with the firebase config as parameter, as documented here : https://firebase.google.com/docs/web/setup. As documented here :…
John Doe
  • 1,092
  • 3
  • 12
  • 25
16
votes
5 answers

Can't determine Firebase Database URL when trying to read Firebase Database from within Node.js Firebase function

I am using Flutter to build an app that accesses the Firebase database. All good from the Flutter side....but I am new to Node.js and Cloud Functions. I am trying to create a Node.js function to react to a deletion event of a record on one Firebase…
16
votes
3 answers

Quota exceeded when updating users with Firebase Admin SDK - how can I request more?

We try to update many users in our multitenant setup, when a whole tenant needs to be enabled/disabled. With this, we sometimes run into QUOTA_EXCEEDED errors, especially for large tenants with many users. I have asked how to do this better here:…
Kariem
  • 4,398
  • 3
  • 44
  • 73
16
votes
1 answer

Authenticating with the Firebase Admin SDK using environment variable

The problem When I try to use an environment variable to authenticate with Cloud Firestore, I get an ENAMETOOLONG error. I've searched so many places for documentation. If anyone can point me in the right direction, that'd be useful. Creating the…
16
votes
2 answers

Firebase Admin Nodejs cannot find module service_account.json

I start my node with "node firebasedb.js". My firebasedb.js contains this code: var admin = require("firebase-admin"); var serviceAccount = require("service_account.json"); // Initialize Firebase var config = { credential:…
Zik
  • 1,556
  • 7
  • 22
  • 31
15
votes
2 answers

firebase-tools getaddrinfo ENOTFOUND metadata.google.internal

I'm getting this error in my terminal: @firebase/database: FIREBASE WARNING: {"code":"app/invalid- credential","message":"Credential implementation provided to . initializeApp() via the \"credential\" property failed to fetch a valid Google…
DanNeo
  • 153
  • 1
  • 1
  • 4
15
votes
8 answers

Python Firebase issue No module named firebase_admin

I have deployed a python code in Google App Engine.In my code,tried to import firebase_admin,but it shows following error, import firebase_admin ImportError: No module named firebase_admin hello.py import firebase_admin from firebase_admin import…
Ramprasad
  • 7,981
  • 20
  • 74
  • 135
15
votes
1 answer

Cloud Functions for Firebase - write to database when a new user created

I am pretty new Cloud Functions for Firebase and the javascript language. I am trying to add a function every time a user created to write into the database. This is my code: const functions = require('firebase-functions'); const admin =…
Idan Aviv
  • 1,253
  • 2
  • 13
  • 23
15
votes
3 answers

Google App Engine - Node: Cannot find module 'firebase-admin'

First time deploying a GAE app here, I'm trying to follow this tutorial: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html (see node code section). I ran npm install firebase-admin --save npm install request…
ypicard
  • 3,593
  • 3
  • 20
  • 34
15
votes
2 answers

nodejs firebase error RangeError: Maximum call stack size exceeded failure

I have an error from the firebase : FIREBASE WARNING: Exception was thrown by user callback. RangeError: Maximum call stack size exceeded I didn't find my mistake. I'm very lost in here, please help. My code looks like…
noam aghai
  • 1,364
  • 3
  • 18
  • 30
14
votes
2 answers

How can scheduled Firebase Cloud Messaging notifications be made outside of the Firebase Console?

Inside the Firebase Console, under the Cloud Messaging view, users are able to create test notifications. This functionality also allows you to schedule the time at which the notification will send to a device or set of devices. Is it possible to…
14
votes
1 answer

Cannot mock admin.firestore() during unit tests

I am reading how to mock google cloud functions for firebase and have issues of properly mocking the following code: const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); var db = admin.firestore(); The example…