Google Cloud storage bucket not listing deleted objects

Two days after having manually deleted all the objects in a multi-region Cloud Storage bucket (e.g. us.artifacts.XXX.com) without Object Versioning I noticed that the bucket size hadn't decreased at all. Only when trying to delete the bucket I discovered that it actually stills containing the objects that I had presumably deleted.

Why aren't those objects displayed in the bucket list view, even when enabling Show deleted data?

enter image description here

enter image description here

enter image description here


Solution 1:

When deploying a Function for the first time, two buckets are created automatically:

  1. gcf-sources-XXXXXX-us-central1

  2. us.artifacts.project-ID.appspot.com

You can observe these two buckets from the GCP Console by clicking on Cloud Storage from the left panel.

The files you're seeing in bucket us.artifacts.project-ID.appspot.com are related to a recent change in how the runtime (for Node 10 and up) is built as this post explains.

I also found out that this bucket doesn't have object versioning, retention policy or any lifecycle rule. Although you delete this bucket, it will be created again when you deploy the related function, so, if you are seeing unexpected amounts of Cloud Storage used, this is likely caused by a known issue with the cleanup of artifacts created in the function deployment process as indicated here.

Until the issue is resolved, you can avoid hitting storage limits by creating an auto-deletion rule in the Cloud Console:

  1. In the Cloud Console, select your project > Storage > Browser to open the storage browser.
  2. Select the "artifacts" bucket from the list.
  3. Under the Lifecycle tab, add a rule to auto-delete old images. Choose a deletion interval that works within your normal rate of deployments.

If possible, try to reproduce this scenario with a new function. In the meantime, take into account that if you delete many objects at once, you can track deletion progress by clicking the Notifications icon in the Cloud Console.

In addition, the Google Cloud Status Dashboard provides information about regional or global incidents affecting Google Cloud services such as Cloud Storage.