I have noticed through the Firebase Console that my gcf-sources buckets (one for each cloud function region) are taking a lot of storage space. (Around 2GB, when my functions folder is only 47Mb).
After digging into one of the buckets, I discovered that every function deployed has 2 folders (presumably for the latest and latest -1 versions). Inside these folders is a .zip file which contains the ENTIRE firebase functions folder. All of the script files, the full node_modules folder etc.
As you can imagine, this adds up very fast and 2GB is understandable.
My questions are:
- Why does every function need a zip file containing the entire functions directory?
- Can I safely delete all of this?
- How can I prevent this from happening in the future?
For a bit more context, I have done full and partial function deploys, but seem to have the same outcome either way.
Note - I came across this problem after following a previous question to clear up my artefacts folders: How to delete outdated Firebase Cloud function containers from GC Storage?