5 uses for Cloud Functions | Get to know Cloud Firestore #12

  Рет қаралды 51,179

Firebase

Firebase

Күн бұрын

Пікірлер: 82
@cindysi63
@cindysi63 2 жыл бұрын
Todd’s a legend. Informative and entertaining.
@Firebase
@Firebase 2 жыл бұрын
Thank you for the kind words, Cindy! We're happy to hear you enjoyed this 🙂
@zackarybrumfield2
@zackarybrumfield2 2 жыл бұрын
This man NEVER needs to be replaced.
@jace1037
@jace1037 4 жыл бұрын
Cloud functions are also a great way to hide privileged API keys from clients. Your client makes a request to the cloud function, your cloud function then verifies the client and user and formats a request to a 3rd party service using credentials that you want to keep hidden from clients.
@averagehelper
@averagehelper 4 жыл бұрын
It’s a joy working with Cloud Functions. We use them all the time in my company’s projects, and it’s been great to keep our Firestore rules manageable. And when things go wrong 😅 it’s super easy to publish a fix so all of our clients can start using the new code almost immediately.
@blocky3664
@blocky3664 2 жыл бұрын
His stickers on his laptop are fabulous
@codinginflow
@codinginflow 4 жыл бұрын
Thank you Firebae
@AkhilKumar-ys3ph
@AkhilKumar-ys3ph 4 жыл бұрын
What are the big websites that are using cloud firestore as a backend?
@lukecross5439
@lukecross5439 3 жыл бұрын
@@AkhilKumar-ys3ph Big? None, the big websites are currently using AWS or Azure with other SaaS
@_mono
@_mono 4 жыл бұрын
‪0:48 #1 Simplifying security rules‬ ‪4:55 #2 Syncing denormalized data‬ ‪7:30 #3 Routine maintenance‬ ‪9:40 #4 Running on top of a legacy database‬ ‪14:00 #5 Build a custom API‬
@leeboyin945
@leeboyin945 4 жыл бұрын
Thank you
@connorflewitt8377
@connorflewitt8377 2 жыл бұрын
How do I know this wasn't done by a cloud function?
@overnightmares
@overnightmares 3 жыл бұрын
I wish I could work with this guy one day. He explains things so clearly. He seems like he can be a very good mentor.
@kevinkumar3520
@kevinkumar3520 4 жыл бұрын
We need a video about caching. I as a beginner struggle a lot to figure out how you can save reads of data which is constantly queried. Thanks for the other tutorials tho, which helped a lot
@cristianberroeta9866
@cristianberroeta9866 4 жыл бұрын
There are great patterns and ideas about Cloud Funtions in the video Todd, thanks! I'm also using Cloud Functions to: - populate my Firestore database (with some constants), and - to apply Firestore "schema" (or data) migrations consistently across multiple environments (development, staging, and production). That also allows me to easily have the migration documented, as the Cloud Function file is included in the project's git repository
@davidstackio
@davidstackio 4 жыл бұрын
How are you triggering the migration functions? I'm hoping to do the same for database "schema" updates
@cristianberroeta9866
@cristianberroeta9866 4 жыл бұрын
​@@davidstackio , I'm glad that you've replied, because I'm just starting to use Cloud Functions for this Firestore migrations use case that I mentioned above, in an app that is not yet published. And in fact, I'm also wondering what would be the best triggering method. Here is the hacky technique that I'm using: This is how my migration Firebase Functions start: exports = module.exports = functions.firestore.document('thisCollectionShouldNotBeCreatedEver/{docId}') .onWrite(async (change, context) => { So it is a Cloud Function that can be triggered by a Firestore document write. However, I never write into that collection. Instead, I use the GCP console to manually trigger it. I go to the Cloud Functions section, press on my migration Cloud Function, then go to the Testing tab and press the "Test the function" button. Hopefully someone will recommend a better way
@davidstackio
@davidstackio 4 жыл бұрын
@@cristianberroeta9866 ah, so just using the console then. Simple, but effective. What about using a callable function that loops through all the documents that need to be changed?
@cristianberroeta9866
@cristianberroeta9866 4 жыл бұрын
@@davidstackio I think that a callable function could also be used. You would have to: - create the UI for calling the callable function - make sure that only authorized users are allowed to trigger the migration. Any user can call a callable function, so you would have to stop them (if they are not a person that you have given the permission to) before triggering the migration in your code. For instance, inside the callable function you could get the caller user's email, and compare it to the authorized user email. Only if they are the same, the code would continue to apply the migration
@sutikshnadubey
@sutikshnadubey 3 жыл бұрын
Keep those humor snippets coming. We developers are sad lot, we need them :)
@dylanking000archive
@dylanking000archive 2 жыл бұрын
thanks so much for this series
@EstebanCodes
@EstebanCodes 4 жыл бұрын
I've use cloud functions to setup an admin api to my dashboard app (the app that controls my real client app) that can query and write everything without worrying about security rules
@AkhilKumar-ys3ph
@AkhilKumar-ys3ph 4 жыл бұрын
What are the big websites that are using cloud firestore as a backend
@lalalarara9209
@lalalarara9209 4 жыл бұрын
already exciting
@Ondal1
@Ondal1 4 жыл бұрын
Still missing a good tutorial on testing cloud functions locally using the emulator. In former videos Google has suggested TypeScript as the preferred way of creating cloud functions, but all examples and semi-tutorials seem to be plain javascript. My direct problem is testing indirect changes, where a function updates another collection. For instance a user updating their name, and this has an effect on review names as in the restaurant on going domain.
@rubenheymans1988
@rubenheymans1988 4 жыл бұрын
Yeah so many plain js examples, and the new extensions code is also plain js, doesn't make any sense
@rubenheymans1988
@rubenheymans1988 4 жыл бұрын
This video is awesome! Learned a lot, got some work flows confirmed, thanks!
@QuangCôngLê-y7v
@QuangCôngLê-y7v Жыл бұрын
Great series! Thanks Todd
@fredericrebel
@fredericrebel 4 жыл бұрын
Would add that having multiple triggers available for a CF is very usefull to ensure Correctness. As it became very straightforward/easy to schedule/run Correctness check batches against same code used by our front-end
@rubenheymans1988
@rubenheymans1988 4 жыл бұрын
A video on multi tenancy would be nice too 😊
@ValAllenSamonte
@ValAllenSamonte 4 жыл бұрын
is multi tenancy with hosting now possible? darn i just wish we can have dynamic subdomains.
@rubenheymans1988
@rubenheymans1988 4 жыл бұрын
@@ValAllenSamonte yes it should be possible, I'm going to implement it for my app I'm working on soon. At this point I just have no idea how the auth flow will work
@rubenheymans1988
@rubenheymans1988 4 жыл бұрын
@@ValAllenSamonte dynamic subdomains would be nice too
@ValAllenSamonte
@ValAllenSamonte 4 жыл бұрын
@@rubenheymans1988 cool! was actually thinking of auth as well, but yeah re. auth, they offer custom JWT tokens anyway so it really is possible.
@davidstackio
@davidstackio 4 жыл бұрын
I'm trying to set this up too. I've opted to go with creating one project per tenant. So more like "multi-single-tenant". Managing all the projects will be a pain, but I'm thinking of building out a management console (as another project) to orchestrate all of them
@puruvijay6185
@puruvijay6185 4 жыл бұрын
That laptop skin is from Spirited Away!! You are awesome Todd Kerpelman
@ijneklim
@ijneklim 4 жыл бұрын
I'm using cloud functions to detect doc change to perform certain operations. But it seems the cloud functions miss some of the operation due to high numbers of invocations. I doubt the reliability of cloud functions... 🤔
@craftrobot
@craftrobot 4 жыл бұрын
So genuinely grateful
@abdonasr1222
@abdonasr1222 4 жыл бұрын
back with a Great video!! Thanks Todd 2020
@Tettoffensive
@Tettoffensive 4 жыл бұрын
One issue that I've run into with using cloud functions for denormalized data is that I still end up having to make changes in my write function on the client to keep certain data in sync that is visible to the user. Otherwise, it can look like whatever the change the user made was not successful until the cloud function syncs all the data back up and the client fetches the new data. Are there any strategies for dealing with this in a clean way? I feel like I end up with a lot of spaghetti code keeping everything in sync.
@ayyappaj8111
@ayyappaj8111 4 жыл бұрын
He is back to form!!!
@hadifromlebanon3812
@hadifromlebanon3812 4 жыл бұрын
You help more than compilers do
@ShivamJha00
@ShivamJha00 3 жыл бұрын
LoL what
@nataliayarysheva7316
@nataliayarysheva7316 Жыл бұрын
cool laptop skin from Spiritted away :D
@Squad2ND
@Squad2ND 8 ай бұрын
Is there a reason to "hide" all implementation details behind a Cloud Function? E.g. read from Firestore. But if I do this, I say Good Bye to any offline capabilities?
@hawarhekmat1174
@hawarhekmat1174 4 жыл бұрын
I live cloud functions but can not understand admin sdk or client sdk I used https request and call request I love it so much wish you can make a video how to use them I am new to firebase and love it
@TheMateusrex
@TheMateusrex 4 жыл бұрын
Great video! Hilarious, informative, and useful.
@chased_productions
@chased_productions Жыл бұрын
2:28 I don't understand. I have to make a new database entry every time a player makes a move? Wouldn't I soon have a million documents with arbitrary player move data that will never be used again?
@rafaelfreitastrad9746
@rafaelfreitastrad9746 4 жыл бұрын
Awesome video, as usual xD
@leonardopillay4200
@leonardopillay4200 4 жыл бұрын
Absolutely love firebase. Is there a way to efficiently detect if a user interacted with a document. e.g liked a post, watched a video etc. I know that there a 20k field limit in a document so storing the ids of the documents and checking them on the fly seems inefficient and created render issues when scrolling a feed for instance.
@sebastiandaza9826
@sebastiandaza9826 3 жыл бұрын
Hi great videos, i've a question if i use the admin sdk inside cloud functions to create or update document, is cloud functions runs ? or in the same way as the rules the admin sdk ignore it
@L1nkk9E
@L1nkk9E 3 жыл бұрын
oof, half abandoned dreams hit hard :D
@jackdbd
@jackdbd 4 жыл бұрын
I have a question regarding the scenario described at 4:55. Let's say that all I need from the review's author comes from the claims in the JWT issued by Firebase Auth. In that case, any update to the user's profile (i.e. the user's profile at the federated identity provider) would trigger firebase.auth().onAuthStateChange(), so any UI component would automatically update if it takes the review's author from firebase.auth().currentUser Would this be enough to avoid the whole cloud function de-normalization shebang?
@Balamurugan-rr3is
@Balamurugan-rr3is 4 жыл бұрын
Sir, I have a one doubt please clear to me... We have create a Android Application backend database is firebase...how to buy a fribase hosting or any other hosting are using in firebase??? Please help me sir we are upload a Android project to playstore but we dont have host and we dont know how to buy host...
@ibearua1052
@ibearua1052 4 жыл бұрын
though unrelated to the above vdeo, i have a current challenge of counting a number of documents of about 300k No. in a single collection, good news is that all the suggestion i had seen suggest maintaining a counter field or using fieldValue is a separate collection that keep track of the each write (or maybe read) in the previous collection, bad news however, is that i had never implemented that. my question is there any work around to get the total of the documents(300k) using cloud functions?
@dhanniekristanto
@dhanniekristanto 4 жыл бұрын
what is the best practice for the database structure, to have a calculated field in your database or do the calculation on the client side? e.g total sum of numbers.
@jace1037
@jace1037 4 жыл бұрын
If it's something that you want to be accurate you can't trust the client to do it. Take for example gold in a game. If the client were to add up the gold a clever player could exploit it and give themselves endless in game gold.
@karlwheeler9076
@karlwheeler9076 4 жыл бұрын
I keep getting a DEADLINE_EXCEEDED error from my firebase function. What does this mean?
@KonesThe
@KonesThe 2 жыл бұрын
Hello, so I've got a question. I have no experience with Databases and I want to run a sensor with a SIM module to communicate with the Realtime Database. With Cloud Functions I want to update the Firestore Database, for every entry on the Realtime Database. I have also an App that will read the information from the Firestore Database. As a starting point, I will only have one client sending data to the Realtime Database, but hopefully this will increase when we sell more of these systems. Will increasing the number of clients present any issue with Cloud Functions? Or will it be able to handle this without an issue. Also, if you guys have any pointers on where to start, I would really appreciate it. I'm fairly new with Firebase and DBs. so I'm watching all the videos and reading documentation to get a feel for it. Like I know I'll probably have to learn TS as well.
@HoussamElbadissi
@HoussamElbadissi Жыл бұрын
I guess that would be okay, given that Cloud Functions, at least from what I understand, are made to be called very frequently and scale effortlessly with your userbase (and hence, database). As for getting started, start from whatever language/platform you'll be using on these devices (make sure it's one with a client-side API), and start with the official docs, to make some simple programs in your computer that contact the database and experiment with reads, writes, and more (in both Realtime and Firestore Databases). You can then try experimenting with Cloud Functions to apply some conversions, sync data between Realtime and Firestore Database, and make sure they work as intended, and don't go above your expectations when it comes to pricing. After this warm up, you can get started with building the actual code that'll live on these systems, testing it from your computer with dummy data, then wiring things up and putting it in the devices themselves. Assuming these are meant to be always connected, it would be great if they could self-update to accommodate any changes you might need to make later on. On the mobile end, you could do the same process as above. Test the APIs and listeners available in the client libraries, build your security rules, and then write and extensively test the actual production code for any security issues. This is a VERY broad "pointer" here, but I hope it can clear things up a bit! (although it's been 7 months now..) This is a really interesting use case, wish you luck!
@ExtraServingsBTS
@ExtraServingsBTS 3 жыл бұрын
Some code for denormalizing data in functions would be most appreciated.
@akashkv41
@akashkv41 4 жыл бұрын
I have created app with newsfeed and chat.I want to create user following and unfollow.how can i do this with firestore?
@michelkant
@michelkant 4 жыл бұрын
Hey! Great video. I saw a reply by someone mentioning hiding api keys by leveraging cloud functions. Which solves for that problem when communicating externally. 👍 I do am very interested in your advice with pubsub. Would you rather have chains of functions communicate through the pubsub api by chaining them via push, a pubsub listener function or not at all and have the functions communicate directly with each other? I am also starting to wonder about the need for subcollections at all 🤔 based on your series I'm getting more and more into just redoing my whole setup to work with only a bunch of main collections, filtering it down with proper queries, security rules and have some functions to act on changes there. Instead of clients as master collection with the same sub sub sub collection structure. Last one, would you recommend building an external facing api with auth and all with/on firebase or rather leverage cloud run? I'd love to see a short series on this if you'd use firebase for it.
@FrankMartinez-uo5yh
@FrankMartinez-uo5yh Жыл бұрын
6:35 🎉
@archit7606
@archit7606 4 жыл бұрын
Need more practical sessions firebase team
@wilmerramirez3631
@wilmerramirez3631 4 жыл бұрын
Hello Everyone! how Can I format text that is stored on a firestore collection... I am rendering some posts which contains properties such as Title, description, content, etc via mapping them on my component but when I render content for example it just display the whole text with the same format... I would like to be able to insert some styling to some sections of that text... I'd appreciate your help.
@eric-ampire
@eric-ampire 4 жыл бұрын
Cloud Function it's very interesting 🎉🙏
@voraponwadsoi3482
@voraponwadsoi3482 4 жыл бұрын
How to get collection id for web ?
@rubenheymans1988
@rubenheymans1988 4 жыл бұрын
I use createId to create a uid on the client, add a property uid to the object. Update the doc in the collection with that uid. Now everytime I fetch the collection, all my docs have the uid as a property
@voraponwadsoi3482
@voraponwadsoi3482 4 жыл бұрын
@@rubenheymans1988 thank you. I'll try it.
@1teamrealtors
@1teamrealtors 4 жыл бұрын
@@rubenheymans1988 Bad idea.
@tilakmadichettitheappdeveloper
@tilakmadichettitheappdeveloper 4 жыл бұрын
1 thing firebase sucks at: auto complete text search it really doesn't make sense to go for algolia a third party service becoz its such a basic feature we all expect to get it natively In firebase
@damiangowala5681
@damiangowala5681 4 жыл бұрын
I really wish there was a feature resembling Firestore Security Rules, but filtering the data instead. Having three user groups with different privileges wishing to access the same document (with all the benefits of a real-time listener), currently there is no way to pass only the chosen fields of the document instead of the whole one. There are so many use cases I have for this feature and cloud functions aren't really a solution here - no real-time support + cold start latency negatively impacting the user experience. Security Rules with direct database querying filters would be an amazing and powerful combination.
@CoderBhavy
@CoderBhavy 4 жыл бұрын
i have error in firebase cli login error in CMD
@markgoho
@markgoho 4 жыл бұрын
that got dark 😂😂😂
@CoderBhavy
@CoderBhavy 4 жыл бұрын
Hello
@dharmarajr24
@dharmarajr24 4 жыл бұрын
37 hours more -_+
@sexyeur
@sexyeur 4 жыл бұрын
AWESOME! Thank you!!!
@dominikfrackowiak5170
@dominikfrackowiak5170 3 жыл бұрын
Hello everyone, I need to sort data stored in a collection by the frequency of the occurrence of the words from that data and then send it to my front-end in a form of an array of, let's say 20, most commonly used words. How can I force firebase to do that for me ;) ? Thank you in advance for any tip.
@mehulbisht9708
@mehulbisht9708 4 жыл бұрын
what an awesome session ! enjoyed it with Todd in live chat !
@JananiNayanathara
@JananiNayanathara Жыл бұрын
just finished the whole series. love this guy.. 💌
Cloud Firestore Data Modeling (Google I/O'19)
40:37
Firebase
Рет қаралды 173 М.
How do Transactions Work? | Get to know Cloud Firestore #8
16:10
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 6 МЛН
WORLD BEST MAGIC SECRETS
00:50
MasomkaMagic
Рет қаралды 52 МЛН
Cloud Firestore Pricing | Get to know Cloud Firestore #3
16:23
How do Cloud Functions work? | Get to know Cloud Firestore #11
18:21
Firestore Data Modeling - Five Cool Techniques
11:44
Fireship
Рет қаралды 256 М.
How to Structure Your Data | Get to know Cloud Firestore #5
13:57
Security Rules! 🔑 | Get to know Cloud Firestore #6
22:39
Firebase
Рет қаралды 273 М.
Firestore Security Rules - How to Hack a Firebase App
10:05
Fireship
Рет қаралды 131 М.
To Realtime or Not?  | Get to know Cloud Firestore #10
11:44
Firebase
Рет қаралды 117 М.
Model Relational Data in Firestore NoSQL
9:13
Fireship
Рет қаралды 377 М.
How Do I Paginate My Data? | Get to know Cloud Firestore #7
10:16