All Questions
7,469
questions
316
votes
9
answers
156k
views
What is Firebase Firestore 'Reference' data type good for?
I'm just exploring the new Firebase Firestore and it contains a data type called reference. It is not clear to me what this does.
Is it like foreign key?
Can it be used to point to a collection ...
203
votes
27
answers
144k
views
Get Download URL from file uploaded with Cloud Functions for Firebase
After uploading a file in Firebase Storage with Functions for Firebase, I'd like to get the download url of the file.
I have this :
...
return bucket
.upload(fromFilePath, {destination: ...
199
votes
17
answers
100k
views
Google Firestore - How to get several documents by multiple ids in one round-trip?
I am wondering if it's possible to get multiple documents by a list of ids in one round trip (network call) to the Firestore database.
183
votes
7
answers
64k
views
Firebase cloud functions is very slow
We're working on an application that uses the new firebase cloud functions. What currently is happening is that a transaction is put in the queue node. And then the function removes that node and puts ...
173
votes
31
answers
321k
views
Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp()
I have a firebase database linked up to two apps, one being an iOS app and another being a web app coded in node.js which is a basic algorithm that sets data to the database. When ever i am running ...
100
votes
10
answers
64k
views
How do I get the server timestamp in Cloud Functions for Firebase?
I know you can pull the server timestamp in web, ios, and android - but what about the new Cloud Functions for Firebase? I can't figure out how to get the server timestamp there? Use case is me ...
94
votes
7
answers
69k
views
Cloud Functions for Firebase - Billing account not configured
I just implemented the new Cloud Functions for Firebase, but there something in the log that bothers me:
Billing account not configured. External network is not accessible and
quotas are severily ...
84
votes
12
answers
83k
views
Firestore: Multiple conditional where clauses
For example I have dynamic filter for my list of books where I can set specific color, authors and categories.
This filter can set multiple colors at once and multiple categories.
Book > Red, ...
82
votes
17
answers
99k
views
TypeError: firebase.storage is not a function
Following this example, I keep getting the error:
TypeError: firebase.storage is not a function
From this line in my code:
var storageRef = firebase.storage().ref();
(And when I simply try to ...
77
votes
8
answers
57k
views
Calling a Cloud Function from another Cloud Function
I am using a Cloud Function to call another Cloud Function on the free spark tier.
Is there a special way to call another Cloud Function? Or do you just use a standard http request?
I have tried ...
77
votes
14
answers
45k
views
Delete a Document with all Subcollections and Nested Subcollections in Firestore
How can you delete a Document with all it's collections and nested subcollections? (inside the functions environment)
In the RTDB you can ref.child('../someNode).setValue(null) and that completes the ...
72
votes
2
answers
63k
views
FireStore create a document if not exist
I want to update a doc like this:
db.collection('users').doc(user_id).update({foo:'bar'})
However, if the doc user_id does not exists, the above code will throw an error.
Hence, how to tell ...
66
votes
6
answers
26k
views
Get code from firebase console which I deployed earlier
I had created firebase functions in nodejs and deployed the code on firebase.
The function was to send an email when the new user is created.
I have lost the code now. Can we pull that code from ...
62
votes
4
answers
88k
views
Firestore Add value to array field
Im trying to use Firebase cloud functions to add the id of a chatroom to the users document in an array field. I cant seem to figure out the way to write to an array field type. here is my cloud ...
61
votes
5
answers
33k
views
Cloud Functions for Firebase - getaddrinfo ENOTFOUND
Trying to make a request to Paypal's API using PayPal-node-SDK
exports.requestPayment = functions.https.onRequest((req, res) => {
return new Promise(function (fullfilled, rejected) {
...
60
votes
4
answers
30k
views
Google Firebase Error(Function returned undefined, expected Promise or value)
I'm developing Server with Firebase.
I had copied Google Developer's Video on Youtube.
It works well, but on log there is an error:
Function returned undefined, expected Promise or value
It says ...
58
votes
1
answer
73k
views
How to add sub collection to a document in Firestore? [closed]
There is no documentation about how add sub collection in a document in Firestore, so how to add a sub collection by using a web app?
I tried this but it didn't work:
How can I add a sub collection ...
57
votes
7
answers
178k
views
Is there any way to get Firebase Auth User UID?
I am looking to fetch Auth User(s) UID from Firebase via NodeJS or JavaScript API.
I have attached screenshot for it so that you will have idea what I am looking for.
Hope you can help me out with ...
54
votes
3
answers
37k
views
Querying by a field with type 'reference' in Firestore
I have a collection called 'categories' containing a single document with ID: 5gF5FqRPvdroRF8isOwd.
I have another collection called 'tickets'. Each ticket has a reference field which assigns the ...
52
votes
7
answers
18k
views
Deploying Firebase App with Service Account to Heroku (environment variables with dotenv)
I have a node application that uses a firebase service account. I would like to deploy the app to Heroku, but I don't want to make my secret keys public. I am deploying directly from a public github ...
52
votes
1
answer
19k
views
What's the difference between the firebase and the firebase-admin npm module?
I want to build a Node.js web app using Firebase (authentication, database and storage). But I get confused on which module should I use, firebase or firebase-admin (or both).
52
votes
7
answers
70k
views
Upload files to Firebase Storage using Node.js
I'm trying to understand how to upload files in Firebase Storage, using Node.js. My first try was to use the Firebase library:
"use strict";
var firebase = require('firebase');
var config =...
52
votes
3
answers
9k
views
Cloud Functions for Firebase - action on email verified
Im trying to create a Cloud Function trigger that will execute after email has been verified.
In the Cloud Functions samples I could only find examples on triggers for onCreate and onDelete.
Within ...
51
votes
4
answers
23k
views
Running Cloud Functions locally gives error "functions.config() is not available"
Cloud Functions for Firebase was just recently released and I am following the instructions on a fresh install. Here is the "Get Started" page.
I have installed "npm install -g firebase-tools" and ...
51
votes
4
answers
13k
views
What is the fastest way to write a lot of documents to Firestore?
I need to write a large number of documents to Firestore.
What is the fastest way to do this in Node.js?
47
votes
25
answers
104k
views
FirebaseCloudMessaging : PlatformException (PlatformException(null-error, Host platform returned null value for non-null return value., null, null))
I'm trying to send notifications from an Node.js API to a Flutter application.
First, I want to make my application able to receive notifications from Firebase.
But, when I initializeApp, I got an ...
47
votes
2
answers
55k
views
How to host nodeJS project to firebase?
I am using node, express and more other dependencies for the project. I wonder how to host this project on firebase. My project will have controller, view , and any other folders to make the project ...
45
votes
8
answers
48k
views
ESLint error while trying to deploy firebase functions
I tried deploying a firebase functions but it keeps failing due to some issue with ESLint. I have also tried googling the answer but everything I am seeing is all Greek to me.
I have also stumbled on ...
45
votes
9
answers
28k
views
Firebase Auth ID token has incorrect "aud" claim
I'm trying to verify an idToken backend. The user has successfully logged in to firebase client side but when I try to verify the idToken on my backend I get this not very helpful error message
...
45
votes
3
answers
16k
views
In firebase - How to generate an idToken on the server for testing purposes?
I want to test a a cloud function that creates users.
In normal cases, inside the browser i generate an idToken and i send it to server via headers: Authorization : Bearer etcIdToken
But I want to ...
44
votes
2
answers
35k
views
What is the difference between Socket.IO and Firebase?
I watched a codeschool tutorial on Node.js and they imitated a chat server using Socket.IO in their tutorial.
I am also under the impression that Firebase does the same thing.
What is the difference ...
43
votes
4
answers
11k
views
Cloud Functions for Firebase error: "400, Change of function trigger type or event provider is not allowed"
When I run firebase deploy I get this error message:
functions: HTTP Error: 400, Change of function trigger type or event provider is not allowed
43
votes
5
answers
43k
views
Firestore: Query by item in array of document
I have 2 collections "photos" and "users" and each document in "users" has one or more photo IDs with an array.
photos > 5528c46b > name: "Photo1"
...
43
votes
9
answers
43k
views
Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail
When I follow the document of firebase, but I can not connect to firebase.
Does anybody face this issue?
https://firebase.google.com/docs/firestore/quickstart
https://firebase.google.com/docs/...
42
votes
9
answers
70k
views
Error: Invalid login: Application-specific password required
i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
const functions = require('...
42
votes
9
answers
26k
views
400 Billing account for project is not found. Billing must be enabled for activation of service(s)
I am create API with firebase via this tutorial here.
On I run:
firebase deploy
I get this error on the command line:
HTTP Error: 400, Billing account for project '381106441303' is not found. ...
42
votes
28
answers
83k
views
'firebase' is not recognized as an internal or external command, operable program or batch file
I am in a bizarre problem, I just updated my Node.js and NPM at the date of 01-Feb-2019. And used the following command-
npm install -g firebase-tools
to install the Firebase CLI
Then on typing ...
42
votes
3
answers
18k
views
Using NodeJs with Firebase - Security
Due to the need to do some server side code - mainly sending emails I have decided to use Nodejs & Express for the server side element along with Firebase to hold the data - Partly from a learning ...
41
votes
18
answers
54k
views
Firebase deploy errors starting with non-zero exit code (space in project path)
I was having issues with firebase deploy command recently. After firebase deploy command all others were being deployed except firebase (storage, database etc) So I decided to reinstall firebase to ...
41
votes
1
answer
30k
views
running queries in firebase using async / await
Appreciating that firebase has added support for promises, is there a way to run a query like the following inside of an async function?:
const eventref = this.db.ref('cats/whiskers');
const value = ...
40
votes
3
answers
12k
views
How to detect if environment is development or production with Firebase Cloud Functions?
How can I detect if my server environment is development or production with Firebase Cloud Functions?
I need something like this:
if (process.env.NODE_ENV === 'development') {
// DO STUFF SPECIFIC ...
40
votes
9
answers
19k
views
how to test Cloud Functions for Firebase locally on pc
Today Firebase released its brand new product Cloud Functions for Firebase and I just created a hello world function and deploy it on my existing firebase project.
It looks like it bundles all ...
39
votes
18
answers
70k
views
firebase cloud error Failed to load function definition from source
unable to deploy changes to firebase cloud
Action:
"Firebase Deploy" in cmd
results:
i deploying functions
i functions: ensuring required API cloudfunctions.googleapis.com is enabled......
39
votes
1
answer
18k
views
How do you authenticate a server to Firebase?
I have an app written on Firebase. Security rules and client side code aren't quite enough to make my app work. I need to connect a server to do a few tasks:
Cleaning up denormalized data that's ...
38
votes
3
answers
47k
views
How to make an HTTP request in Cloud Functions for Firebase?
I am trying to make a call to apples receipt verification server using Cloud Functions for Firebase. Any idea how to make an HTTP call?
37
votes
11
answers
25k
views
How to get Firebase Project Name or ID from Cloud Function
I am using Cloud Functions and want to get the project name from within one of my Javascript server files. I know that value is stored in the .firebaserc, but I don't think that file is available on ...
35
votes
3
answers
37k
views
Read data from cloud firestore with firebase cloud function?
I'm an Android developer and recently I've started working on a project based on firebase cloud functions and firestore database. I'm writing an HTTP trigger function that will take two parameters and ...
35
votes
4
answers
31k
views
Firebase and backend logic
I am parse.com user, and now I look for another service.
How can I write back end logic to firebase?
let say I want to validate all the values on server side, or trigger things. I thought about one ...
34
votes
11
answers
48k
views
The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services. at FirebaseAppError
I am learning to use Firebase Cloud Function and I am following Firebase's official tutorial video for Learn JavaScript Promises (Pt.1)
When I run a local server and go to the HTTP link I get
...
34
votes
1
answer
14k
views
Firebase serve --only functions VS local emulator to run cloud functions locally?
Up until now I've been doing the following to use and test my functions locally during development:
I leave this running in one terminal:
firebase serve --only functions
And I add this on my client ...