Questions
Browse questions with relevant Google Cloud tags
13,581 questions
Has recommended answerHow can I change the output folder of the generated SDK in Firebase DataConnect? [closed]
From looking at the documentation, there is a connector.yaml file in the dataconnect/connector directory, which includes a outputDir property for each SDK. So for the JavaScript SDK, that'd look ...
Is it possible to get Google Calendar API access token directly from Firebase GoogleAuthProvider?
Based on the Firebase documentation for signInWithPopup, this example from the documentation on GoogleAuthProvider seems to do what you want: // Sign in using a redirect. const provider = new ...
How to query Firebase Realtime Database for top N users and current user’s rank
The Firebase Realtime Database hasn't significantly changed in about a decade now, and both these topics have been covered extensively in the past. So while I'm writing up an answer here for your ...
Why does a decoded Date from Firebase have a small milliseconds offset in Swift?
Why does this small floating-point offset appear when decoding a Firebase timestamp into a Swift Date? A Firestore Timestamp consists of two values: and integer number of seconds since unix epoch, ...
Firebase: Fetching documents from a database that is not default, but is still in the same project
First initialize Firebase as usual, then get the database by specifying its ID like this: let db = Firestore.firestore(app: FirebaseApp.app()!, databaseID: "Staging") Also see the reference ...
Rules for checking document key existence in Firestore
With Firestore security rules, your query must match your rule. So, if your rule demands that some condition be met, your query must absolutely ensure that condition holds for all matching documents, ...
Firebase onCall function returning null even though await is there
You didn't mention it in your question, but I'll say it here to help others in the future: you're using the nodemailer module to send email. The nodemailer API you're using is the sendMail method on ...
Firestore security rules: allow read only if custom claim pst is "true" or not present
According to the documentation for request.auth, request.auth.token is a Map object, so you will want to review the documentation for the Map object. In there, you will see that there is syntax for ...
Firebase databaseReference returning all data only in iOS
Unfortunately this is one of a number of known issues with the implementation of getData() on iOS (#12168, #14137, #12965, #8286). Since the Flutter SDK wraps the native SDKs, it is affected by this ...
Firebase Auth loses authentication state on Android app restart - user gets logged out when app is killed and reopened
Please never do something like this: Future.delayed(const Duration(seconds: 10), () { if (!_hasNavigated && mounted) { if (FirebaseAuth.instance.currentUser != null) { ...
Failed to resolve: com.github.firebase:FirebaseUI-Android:version-9.1.0-dev-387e7c2e01-1
It looks like you're trying to specify both the name of a branch and a commit hash. I don't see that that is supported by jitpack. If you want to target a specific commit, just provide the commit ...
Should the same email be allowed to register with multiple auth providers (email, Google, Apple)?
When it comes to the relationship between your users and your app, as @FrankvanPuffelen already mentioned in his comment, it is essential to have a single email address that identifies your users. ...
Firestore Security Rules resource.data is not returning correctly
Your query can never work. You're reading the messages subcollection, but your rules depend on data that is only present in the dms document(s). The rules engine will not read that parent document, ...
Firebase Admin SDK db object is invalid in Vercel API Route ("Expected first argument to collection...")
You're mixing use of the Firestore client SDK firebase/firestore and the Firebase admin SDK wrapper firebase-admin/firestore. They are not compatible with each other. If you intend to use the ...
How can I use an npm package's types without adding the package as a dependency?
TypeScript module bundlers such as tsup and zshy don't do anything special to recreate or export types from module source code. As you have found, they simply arrange to re-export exactly what your ...
How can I get raw parameter values for a Firebase Analytics event (last 30 days) without using BigQuery?
The only way to get that level of data detail of individual Google Analytics event is through the BigQuery export. There is no other way to get this level of detail. If you can't use BigQuery for some ...
Why can anyone call my Firebase callable Cloud Function via its HTTPS URL, outside my mobile app?
I assumed that onCall functions could only be invoked by my app’s authenticated clients. That's definitely not true. the request still causes the function instance to spin up (cold start), meaning ...
Firebase Auth currentUser null on cold start due to KeysetManager failed to initialize on Redmi Note 13 HyperOS
On cold start (after killing the app process), FirebaseAuth.getInstance().currentUser returns null That is somewhat expected, as Firebase needs some time to check with the server whether the ...
How to check if attribute matches in an array of maps
Checking whether an item is in an array in Firestore (both its query API and its security rules) requires that you specify the full item. There is no way to check for a partial match. The common ...
Is It Safe to Use stream() Inside a Firestore Transaction in Python?
You shouldn't do any reading or writing (including, but not limited to stream) of the database within a transaction that doesn't use the provided transaction object. That's because 1. Transactions ...
How to delete Firestore document when a user closes the web page [closed]
As Pointy commented, there is no reliable way to perform an action on a client right before a web page is closed. The closest equivalent is to use the onDisconnect feature of the Realtime Database (...
Firestore cardinality vs effective cardinality in Composite Indexing
With a query like the one you show here, which contains only equality filters and only one ordering, the order of the equality filters in the query doesn't matter. Firestore (like most production ...
Firestore Security Rules: Getting all docs with field-specific "where"-query
It seems to me that you're running into a known limitation of security rules. Essentially, you can't use the result of a single get() to control access to a full query from a client, but you can when ...
Google Sign In Fails with Firebase - signInWithRedirect fails, but signInWithPopup works fine
When you call signInWithRedirect, the browser navigates away from the page that made the call, which means that javascript is no longer running, and does not return a result. You must write code to ...
firebase function fails to send push notification with socket disconnect
You're not dealing with promises correctly for Cloud Functions. Your function must return a promise that resolves only after all other async work is complete. When you use forEach, that "...
Firebase Auth & Flutter Web Platform Persistence After Logout (Google Auth Provider)
My guess is that the Google sign-in is still persisted, not so much the Firebase sign-in. So when the new user clicks sign-in, the code sees there's an active Google sign-in and picks that up. You'll ...
Writing data to a child node in Firestore
In addition to Doug's answer, I would like to mention that the first piece of code works because you're calling the addDoc function and you're passing as the first argument a CollectionReference ...
Firebase deploy --only functions:myFunction in Gen2 Cloud Run - Pulling all my files with other functions
All files in your functions directory are deployed to each container, but only the identified function(s) are wired up. So in your scenario, all the code ends up in the new contains but only the ...
Error auth/network-request-failed while using expo go app with react native and firebase
That error could refer to any number of problems with the network between your app and Firebase during the execution of one of its APIs. It's impossible for us to tell for sure what it means in your ...
Firestore runTransaction takes multiple minutes
You're not performing the transaction correctly. In a transaction handler, all reads and writes for documents database absolutely must use the Transaction object t you were provided in the callback. ...
Flutter Firebase-ai-logic live api doesn't compile
From looking at the reference documentation of , the method might be called liveGenerativeModel. That also seems to match the code sample in the GitHub repo of the SDK.
Firestore cache initially returns just a single document with `fromCache: true`
I don't think there is a way to get exactly the behavior you want. The main problem is that the local persistence layer provided by the Firestore SDK will store and delete documents under ...
FCM: I don't understand "An application instance cannot be subscribed to more than 2000 topics."
The limitation means that a single device (strictly speaking: a single FCM token) can be subscribed to no more than 2,000 topics at any point in time. If you've reached the 2,000 topic limit on a ...
When a long running cloud function is called firebase ios sdk throws DEADLINE EXCEEDED exception
If the timeout error is happening in your client code and not the backend function, that means you need to increase the timeout on the client. The default is 60 seconds. You can increase it using ...
Firestore in Flutter: How to call all documents in a collection without their data? [duplicate]
The Flutter SDK for Firestore always loads full documents. There is no option in it to load a partial document, or only document metadata. If your use-case requires that you load a subset of the data, ...
How to remove user data with Firebase Functions V2?
Currently, according to this issue, you can't use gen1 functions with the node 22 runtime: https://github.com/firebase/firebase-functions/issues/1653 And, according to the documentation, you can't use ...
How do I use Parameterized configuration with Firebase Functions onSchedule?
It's not possible. Take a look at the ScheduleOptions definition for onSchedule from the source code: export interface ScheduleOptions extends options.GlobalOptions { /** The schedule, in Unix ...
How do I get the headers of the request that invoked a GCP workflow?
You can't invoke a workflow with a request, you question does not make sense! Only Cloud Event (from Cloud logging or native), Cloud storage and PubSub can invoke the workflow and pass the value as ...
Do you need await for writes and transactions in Firebase Realtime Database?
The await keyword does little to nothing to change the way any asynchronous API works (including Firebase APIs) that returns a promise. It just tells JS that you want to suspend execution to wait for ...
Run global scope initialization only for specific Google Cloud Functions (Node.js)
You can simply assign the result of heavyComputation to a global non-const variable (let), gated by a check to see if the work has previously been done in the first invocation of function A (once for ...
Firebase Storage permission error when security rules get document from Firestore
According to the documentation, the syntax for getting a document from Firestore from within Firebase Storage rules is firestore.get(...) (not get(...) as you have now). You can access documents in ...
Firestore REST API Query
As I see in your shared code, you're using the wrong HTTP method for the REST API call. According to the official documentation, the runQuery requires a POST request, not a GET: POST https://firestore....
Firebase - Max instances must be set to 10 or fewer to set the requested total instances
When you see this message: Max instances must be set to 10 or fewer to set the requested total instances. It means that the maximum number of instances that can be set for your region is 10. Going ...
Issues With Firebase Rules Configuration
Firebase has two NoSQL databases Firebase contain two NoSQL databases: the Realtime Database and Cloud Firestore. Both of these are part of Firebase, and support server-side security rules, but they ...
The query limitation with max 30 filter parameters still exists in GCP Firestore Enterprise with MongoDB compatibility?
Firestore has query limitation with max 30 filter parameters in a single query. Yes, that's correct. You can combine up to 30 clauses when using in, not-in, and array-contains-any operators. The same ...
Firebase Function to send Notification
The problem in your code lies here: const functions = require('firebase-functions'); // 👆 In order to make it work, you need to specify the version: const ...
Messages snapshot error: FirebaseError: Missing or insufficient permissions. Request when trying to make a messaging system for my website
This condition in your query: where('participants', '==', participants), Does not match with this condition in your security rules: request.auth.uid in resource.data.participants The first checks ...
"Cannot parse Firebase url" when using firebase database in flutter
Given how you call initializeApp the Firebase SDK will try to read the URL for the Realtime Database (which is what you use when you depends on firebase_database and access FirebaseDatabase API calls) ...
How would this Firestore query analysis translate to cost?
According to those query execution stats you will be billed for 326 document read operations, from the look of it because of the 325,192 index entries that were billably scanned (as scanned-but-not-...
Realtime Database structure creation fails – values disappear or produce errors
The Firebase Realtime Database stores values at hierarchical paths. If there is no value at a given path, that path does not exist. Since the JSON snippet in your question consists only of keys and ...
Simply submit a proposal, get it approved, and publish it.
See how the process works