13

I am working on a new project and the problem is my firebase storage is filling gradually up even as I dont use it, right now its 4,1 GB big.
I did not have a bucket created and it was filling up.
One thing I tried to do was to look at the files in the cloud console but all of them are of a weird format that I can not manage to open up.
Until now I was not even working with media that could take up that space.
I would appreciate ideas how to backtrack the usage.

enter image description here this is how my 3 GB bucket (I never uploaded something to it) looks like, any idea how I can open these files?

DavidGetter
  • 349
  • 3
  • 12
  • I have the same problem. Only thing I can think is that I upgraded the node engine, and they may be some artifacts from the cloud functions build? Have you done the same? – joejknowles Sep 10 '20 at 20:54
  • At the very beginning of my project i've changed node from "8" to "10" in the package.json but since it was the very beginning I can't think of 5GB worth of artifacts to be stored, the Bucket keeps getting bigger and just recently hit 5GB. – DavidGetter Sep 11 '20 at 10:39
  • 1
    Yeah, it's to do with how google deploys them now. They use a VM which generates these container images, it's not related to the file sizes of your functions code or anything, I don't think. As you said in the other comment, it's more to do with how many times you deploy. I'm also wondering if it's affected by whether you deploy one function at a time or all of them. I've asked support about this too and am waiting on their response. – joejknowles Sep 11 '20 at 11:29

1 Answers1

16

A change to how firebase are deploying functions from node 10 onwards means they automatically add container image files to your cloud storage with every deployment. This counts towards your "Bytes stored" and "Bandwidth" limits in firebase.

To save costs you can delete all these files, and only deploy individual functions with firebase deploy --only functions:myFunctionName instead of deploying them all at once.

The following is a screenshot from firebase support: screenshot from firebase support Links from image Cloud Build Container Registry Firebase pricing FAQ

joejknowles
  • 350
  • 2
  • 12
  • To be honest there were days I did deploy a lot of functions over and over but I had no idea they took that much of space. Do you know of a way to know for certain that these can be deleted safely? – DavidGetter Sep 11 '20 at 10:45
  • 1
    I've found confirmation that you can delete container images for their app engine builds, but I'm not certain it applies to functions: "Once deployment is complete, App Engine no longer needs the container images. Note that they are not automatically deleted, so to avoid reaching your storage quota, you can safely delete any images you don't need." https://cloud.google.com/appengine/docs/standard/go/testing-and-deploying-your-app#managing_build_images I'm currently waiting on a response from their support team to confirm. Same with deploying over and over, I did that yesterday – joejknowles Sep 11 '20 at 11:23
  • Let me know when you get an answer, it might be interesting to other people besides us, since i did not found much about this problem. – DavidGetter Sep 11 '20 at 11:32
  • Yeah, will do. – joejknowles Sep 11 '20 at 15:25
  • @DavidGetter Responded + Updated ^ – joejknowles Sep 12 '20 at 08:22
  • @joejknowles This answer is really helpful, I don't have good knowledge about node.js and how these things actually work. However, I read some documentation and deploy 2 functions at the same time There were two functions, one function for getting the average rating and another one for count comments I have saved this two function in the same index file. As I understand should create two different indexes for each one and deploy or using the same index file and referencing the function name and deploy? – Isuru Bandara Sep 30 '20 at 18:50
  • So when i deleted all of the images and stuff, it seems that the functions has an error when trying to deploy them: `Functions did not deploy properly`. – Tony Zhang May 31 '21 at 01:21
  • @TonyZhang, so eventually were you able to deploy properly, if yes then how? – Avi R Sep 28 '21 at 01:20
  • @Avi R what worked was deleting the functions and redeploying them, but I’m not sure if that’s the correct way. – Tony Zhang Sep 29 '21 at 13:44
  • I followed the following steps : 1. updated firebase-functions to latest (it was already complaining about this whenever I used to deploy any function) 2. From the Google Cloud Console (web) went to Functions and deleted all of my functions, https://console.cloud.google.com/functions/list?project= 3. From the cloud console (web) deleted all the images ,https://console.cloud.google.com/storage/browser?project=, the bucket name should be something like us.artifacts..appspot. 4. From CLI deployed functions **one by one** Storage went down from 527MB to 5.2MB – Avi R Oct 01 '21 at 04:23