This question already has answers here:
Delete firebase data older than 2 hours
(5 answers)
Closed 2 years ago.
I want to clear data from Firebase database every 24 hours, but I do not want to do this from code in my project, but from the Firebase.
Do firebase have such functions?
Yes it does. Please use the functions from Cloud Functions for Firebase.
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
Hope it helps.
Related
This question already has answers here:
Locking down Firebase DB access to specific apps
(2 answers)
Closed 3 months ago.
I have two apps registered in Firebase, say App A and App B. I haven't setup any firebase authentication system but I want to allow requests only from App A and App B. I want to check if the request is coming from my apps and then only perform the actions. If the request is from somewhere else then just reject it.
I want to have this security for Cloud Firestore and Firebase Storage.
Currently, this feature isn't available, some of this will be rolling out in the near future using the new App Check: https://firebase.google.com/docs/app-check
At this time, App check only supports:
Realtime Database
Cloud Storage
Cloud Functions (callable functions)
This question already has answers here:
Is it safe to expose Firebase apiKey to the public?
(10 answers)
Should I hide firebase api keys into backend? Not due to data security but project cloning issue
(2 answers)
Closed 2 years ago.
I have been messing around with Firebase in a web app and realized there's something I don't understand.
In order for the JS code to send data to the Firebase servers, your apiKey has to be in the JS. But then that means your API key is public, and anyone using your website can inspect the code and just send arbitrary commands to Firebase on your behalf from the dev tools, or from any other site now that they have the API key.
I know I must be missing something, since this would make Firebase not useful. What is it I'm missing? What prevents users from sending arbitrary commands to Firebase with your ApiKey?
This question already has answers here:
Cloud Functions for Firebase trigger on time?
(3 answers)
Closed 3 years ago.
I use Firebase cloud functions and it has worked well so far.
However, my app has a new feature that requires setInterval.
More specifically, the feature consists of simulating geo-coordinates of a fleet of cars based on their direction and velocity which varies over time.
Every 5 seconds, I calculate the new coordinates and update the firebase real-time database.
I have already written the code using setInterval and it runs in NodeJs on my local machine. But I just discovered that Firebase will kill my code after 9 minutes.
What can I do ?
Why not have the client side update a trigger document every X minutes to keep the function firing?
This question already has answers here:
Cloud Functions for Firebase trigger on time?
(3 answers)
Closed 4 years ago.
I want to automatically update a child value in firebase database, monthly.. How can I handle this?
There is nothing built into the Firebase Realtime Database to automatically update values periodically. So you will have to write the code for this yourself.
After you write the code you will need to run that code periodically.
If you put the code into the app, you can run it periodically there. It's technically possibly, but a bit involved (is the app running all the time?, what if multiple users run it?, etc).
So the more common approach is to run that code on a server. If you don't have a server yet, you can run the code in Cloud Functions for Firebase, which allows you to run small pieces of (for now only JavaScript or TypeScript) code on Google's servers. To trigger this code to run monthly, see Cloud Functions for Firebase trigger on time?
There is nothing fully integrated at the moment.
One way would be to use a Google Cloud scheduler job that will start your process in a Google Cloud function once a month.
You will only pay once a month for the duration of your function.
You can have an example here
This question already has an answer here:
Revert from Google Cloud Firestore to Datastore
(1 answer)
Closed 4 years ago.
I have used Firestore before, but since there is a "Beta limits" right now, I want to use Datastore instead of Firestore.
And here is the problem... When I open Datastore in the Google Cloud console, I see this message. Even when I tried to disable Firestore API, it still shows up. Is there any way to use Datastore after creating a Firebase project?
It seems revert from Google Firestore to Datastore is not possible without deleting project or creating a new one.
See this answer by Product Manager at Google.