Skip to main content

Posts

Showing posts from December, 2020

My story of infinite loop on firebase...

   So recently I heard the news of a startup "Announce" getting a bill of $72k and almost bankrupting them in the process. Story can be found here. When I heard the news I was thinking about the same mistake that was made by me. if you are a programmer, chances are that you heard about good old recursion. Recursion is a powerful strategy for solving problems, but with great power comes of course great responsibilities. Missing an edge case in a recursion can cause a huge conundrum and your resources getting exploited pretty quickly, all thanks to the infinite recursion that's been happening on the background. Now in the cloud, recursion is little bit of the same line but brings forth another set of problems as well. In my case, I wrote a cloud function in firebase, that will update the date of a set of documents inside a particular collection when data is being **modified** in the same collection. Yes I know, dumb! I thought of making the cloud function such tha