Questions tagged [firebase]
Firebase is a serverless platform for unified development of applications for mobile devices and for the web.
firebase
143,316
questions
832
votes
10
answers
275k
views
Is it safe to expose Firebase apiKey to the public?
The Firebase Web-App guide states I should put the given apiKey in my Html to initialize Firebase:
// TODO: Replace with your project's customized code snippet
<script src="https://www.gstatic....
572
votes
31
answers
614k
views
How to handle notification when app in background in Firebase
Here is my manifest:
<service android:name=".fcm.PshycoFirebaseMessagingServices">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT&...
490
votes
28
answers
418k
views
No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp() in Flutter and Firebase
I am building a Flutter application and I have integrated Firebase, but I keep getting this error when I click on a button either to register, login, or logout. I have seen other people have asked the ...
432
votes
6
answers
181k
views
What's the difference between Cloud Firestore and the Firebase Realtime Database?
Google just released Cloud Firestore, their new Document Database for apps.
I have been reading the documentation but I don't see a lot of differences between Firestore and Firebase DB.
The main ...
422
votes
9
answers
368k
views
Convert Promise to Observable
I am trying to wrap my head around observables. I love the way observables solve development and readability issues. As I read, benefits are immense.
Observables on HTTP and collections seem to be ...
352
votes
32
answers
528k
views
firestore: PERMISSION_DENIED: Missing or insufficient permissions
I am getting the Error
gettingdocuments.com.google.firebase.firestore.FirebaseFirestoreException:
PERMISSION_DENIED: Missing or insufficient permissions.
for the below code on else statement
...
346
votes
21
answers
74k
views
API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()
Using Android Studio 3.3 Canary 11 with the gradle plugin version 3.3.0-alpha11. It throws the following error when trying to sync gradle
WARNING: API 'variant.getExternalNativeBuildTasks()' is ...
330
votes
31
answers
290k
views
Firebase onMessageReceived not called when app in background
I'm working with Firebase and testing sending notifications to my app from my server while the app is in the background. The notification is sent successfully, it even appears on the notification ...
330
votes
30
answers
286k
views
Cloud Firestore collection count
Is it possible to count how many items a collection has using the new Firebase database, Cloud Firestore?
If so, how do I do that?
315
votes
9
answers
155k
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 ...
310
votes
7
answers
631k
views
How can I solve the error 'TS2532: Object is possibly 'undefined'?
I'm trying to rebuild a web app example that uses Firebase Cloud Functions and Firestore. When deploying a function I get the following error:
src/index.ts:45:18 - error TS2532: Object is possibly '...
306
votes
8
answers
265k
views
Query based on multiple where clauses in Firebase
{
"movies": {
"movie1": {
"genre": "comedy",
"name": "As good as it gets",
"lead": "Jack Nicholson&...
296
votes
57
answers
282k
views
Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
The dialog (Google form) for the credentials is opened successfully, but after I fill my credentials I'm getting this error. I followed the instructions from here. Created a Firebase project, enabled ...
294
votes
6
answers
256k
views
Firebase Storage How to store and Retrieve images [closed]
How to store and view images on firebase?
293
votes
19
answers
174k
views
FirebaseInstanceIdService is deprecated
Hope all of you aware of this class, used to get notification token whenever firebase notification token got refreshed we get the refreshed token from this class, From following method.
@Override
...
289
votes
7
answers
92k
views
How do I solve: Error: Failed to list Firebase projects. See firebase-debug.log for more info
So I'm minding my own business trying to initializing a Firebase project in my Angular app when all of the sudden I'm hit with this error:
Error: Failed to list Firebase projects. See firebase-debug....
273
votes
6
answers
119k
views
Difference Between Firestore Set with {merge: true} and Update
In Cloud Firestore there are three write operations:
add()
set()
update()
In the docs it says that using set(object, { merge: true }) will merge the given object with the existing document.
The same ...
272
votes
34
answers
258k
views
Enabling CORS in Cloud Functions for Firebase
I'm currently learning how to use new Cloud Functions for Firebase and the problem I'm having is that I can't access the function I wrote through an AJAX request. I get the "No 'Access-Control-...
270
votes
12
answers
112k
views
Separate dev and prod Firebase environment
I am considering using Firebase as MBaaS, however I couldn't find any reliable solution to the following problem:
I would like to set up two separate Firebase environments, one for development and one ...
266
votes
13
answers
189k
views
Failed to resolve: com.google.firebase:firebase-core:9.0.0
I get the following error while upgrading a firebase project from old domain to new google firebase domain.
Failed to resolve: com.google.firebase:firebase-core:9.0.0
I followed the steps ...
262
votes
13
answers
184k
views
Flutter: CocoaPods's specs repository is too out-of-date to satisfy dependencies
Current, I was trying to add firebase_core: ^0.5.0+1 and firebase_crashlytics: ^0.2.1+1 packages in my flutter project with the latest versions, It works without any trouble in Android but in iOS, it ...
257
votes
17
answers
447k
views
How can I send a Firebase Cloud Messaging notification without use the Firebase Console?
I'm starting with the new Google service for the notifications, Firebase Cloud Messaging.
Thanks to this code https://github.com/firebase/quickstart-android/tree/master/messaging I was able to send ...
230
votes
19
answers
98k
views
How do I structure Cloud Functions for Firebase to deploy multiple functions from multiple files?
I would like to create multiple Cloud Functions for Firebase and deploy them all at the same time from one project. I would also like to separate each function into a separate file. Currently I can ...
222
votes
9
answers
116k
views
How to protect firebase Cloud Function HTTP endpoint to allow only Firebase authenticated users?
With the new firebase cloud function I've decided to move some of my HTTP endpoint to firebase.
Everything works great... But i have the following issue. I have two endpoints build by HTTP Triggers (...
215
votes
9
answers
112k
views
Transferring an app to another Firebase account
I have a few apps under my personal firebase account for testing, but now need to transfer an app to a client's account for billing purposes. Is this possible?
Thanks!
214
votes
12
answers
449k
views
NullInjectorError: No provider for AngularFirestore
I'm learning Angular looking for help in fixing the error:
I'm following this link : https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md
to create a angular small app with ...
211
votes
26
answers
199k
views
How do I convert a Firestore date/Timestamp to a JS Date()?
I am trying to convert the below date to a javascript Date() object. When I get it back from the server, it is a Timestamp object,
Screenshot from Firebase Firestore console:
When I try the ...
211
votes
28
answers
162k
views
Google Firestore: Query on substring of a property value (text search)
I am looking to add a simple search field, would like to use something like
collectionRef.where('name', 'contains', 'searchTerm')
I tried using where('name', '==', '%searchTerm%'), but it didn't ...
210
votes
11
answers
214k
views
type 'List<dynamic>' is not a subtype of type 'List<Widget>'
I have a snippet of code which I copied from Firestore example:
Widget _buildBody(BuildContext context) {
return new StreamBuilder(
stream: _getEventStream(),
builder: (context, ...
209
votes
11
answers
197k
views
Firebase messaging, where to get Server Key?
Firebase allows us to send notification messages via our own application by making POST request.
This tutorial, gives to us instructions how to make this request. However, there is Authorization ...
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: ...
203
votes
12
answers
189k
views
How to add Document with Custom ID to firestore
Is there any chance to add a document to firestore collection with custom generated id, not the id generated by firestore engine?
201
votes
5
answers
46k
views
HTTP Error: 401 while setting up firebase cloud functions for android project
I`m trying to set up firebase functions, but I get an error after running firebase init.
Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login ...
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.
198
votes
13
answers
293k
views
Where can I find the API KEY for Firebase Cloud Messaging?
I am trying to figure out how the new version of GCM or Firebase Cloud Messaging works so I moved one of my projects to the new Firebase console, If I did not have the API KEY or I want to create a ...
196
votes
5
answers
139k
views
Firebase Storage and Access-Control-Allow-Origin
I'm trying to download files from Firebase Storage through a XMLHttpRequest, but Access-Control-Allow-Origin is not set on the resource, so it's not possible. Is there any way to set this header on ...
193
votes
35
answers
196k
views
CocoaPods could not find compatible versions for pod "Firebase/CoreOnly"
I've updated my flutter package to the last versions and now IOS doesn't work anymore.
When I try to update the pods it shows this error:
[!] CocoaPods could not find compatible versions for pod "...
193
votes
18
answers
221k
views
How to update an "array of objects" with Firestore?
I'm currently trying Firestore, and I'm stuck at something very simple: "updating an array (aka a subdocument)".
My DB structure is super simple. For example:
proprietary: "John Doe",
sharedWith:
[...
192
votes
24
answers
79k
views
Error: Failed to get Firebase project project-name. Please make sure the project exists and your account has permission to access it
I tried running firebase deploy like I have always done but came across this Error:
Error: Failed to get Firebase project project-name. Please make sure the project exists and your account has ...
190
votes
11
answers
122k
views
Firestore query subcollections
I thought I read that you can query subcollections with the new Firebase Firestore, but I don't see any examples. For example I have my Firestore setup in the following way:
Dances [collection]
...
189
votes
9
answers
118k
views
How do I switch apps from the firebase cli?
This seems like something which should be pretty easy to do, but for whatever reason, I'm being defeated.
I'm trying to use the firebase-tools CLI to interact with my database. I'm able to login ...
185
votes
23
answers
340k
views
Plugin with id 'com.google.gms.google-services' not found
I have followed this link to integrate ads in my app. But it shows this error:
This is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android ...
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 ...
181
votes
9
answers
71k
views
How to deploy some functions to Cloud Functions for Firebase without affecting some other functions?
When I run
firebase deploy --only functions
it reads the index.js file and updates all functions exported from that file. If on the previous deploy there was a function named a, and in the current ...
180
votes
8
answers
137k
views
MongoDB vs Firebase [closed]
MongoDB vs Firebase
What are some quantitative advantages of using Firebase over MongoDB? (not opinions)
I know that Firebase is a cloud-based service with its own API, but I feel like Mongo may give ...
176
votes
25
answers
136k
views
Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task
I've checked this answer:
https://stackoverflow.com/a/34834772/13519865
It tells us to remove this line
apply plugin: 'com.google.gms.google-services'
Removing the line as asked completes the build, ...
174
votes
10
answers
184k
views
Why is my React component is rendering twice?
I don't know why my React component is rendering twice. So I am pulling a phone number from params and saving it to state so I can search through Firestore. Everything seems to be working fine except ...
171
votes
22
answers
116k
views
Didn't find class "com.google.firebase.provider.FirebaseInitProvider"?
I am getting the below exception on app launch.
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find ...
171
votes
20
answers
140k
views
Unable to get provider com.google.firebase.provider.FirebaseInitProvider
I am testing the new Crash tool:
https://firebase.google.com/docs/crash/
After going through the steps, the app launches and it crashes saying:
05-18 17:28:18.870 28743 28743 E AndroidRuntime: java....
171
votes
3
answers
79k
views
What Does WidgetsFlutterBinding.ensureInitialized() do?
I am trying to use the Firebase package with the below line of code.
I really want to know what this line of code actually does?
The official documentation didn't help me much. Can someone explain me, ...