Firebase storage artifacts is huge and keeps increasing

I assume this is related to firestore functions deploys (or not?), but is this really expected?

Yes, it's expected. Every time you deploy functions, Cloud Build will use a dedicated Cloud Storage space for the built docker image, and retain it until you delete it.

Can I cleanup this artifacts safely?

Yes, but then you won't be able to easily revert to a prior image. You would have to deploy again from your own source code.

Figured out a solution - it appeared there is a way to setup an auto deletion rule in google cloud console for those images that clutter the storage.

  1. go to the google cloud console, select your project -> storage -> browser

  2. Select the "artifacts" bucket

  3. Under the "lifecycle" tab add a rule to auto delete old images (in my case I put "delete after 1 day since update" which works fine for me)

enter image description here

Storage is safe now!

NOTE: if you face any deployment issues later, like if you deploy several days in a row and if it gives you an error on deploy, just delete the whole "container" folder manually in the artifacts which should solve it and then redeploy again. (make sure not to delete the artifacts bucket itself!)

Hope the firebase team will improve that - the current behavior looks confusing as it easily leads to an unexpected bill unless you take extra steps to prevent that. But you'll never know that it will happen until it does.