0

After realizing I was being charged for storage as a result of Google Cloud Functions deployments, I read this thread and created a 3-day deletion rule for my us.artifacts.{myproject}.appspot.com folder. Now I am trying to deploy an existing function and am getting the below. How can I resolve this? Should I delete the whole image folder?

[0mfailed to export: failed to write image to the following tags: [us.gcr.io/myproject/gcf/us-central1/3a36a5e8-92b5-426e-b230-ba19ffc92ba8:MYFUNCTION_version-64: 
GET https://storage.googleapis.com/us.artifacts.myproject.appspot.com/containers/images/sha256:{some long string}?access_token=REDACTED:
unsupported status code 404; body: <?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message><Details>No such object: us.artifacts.myproject.appspot.com/containers/images/sha256:{some long string}</Details></Error>]

Edit 1: My deploy command (which has been previously working for months):

gcloud functions deploy MYFUNCTIONNAME --source https://source.developers.google.com/projects/MYPROJECT/repos/MYREPO --trigger-http --runtime nodejs10 --allow-unauthenticated

Edit 2: I have an separate cloud function that points to the exact same source repository (but is located in europe-west3) and it updated fine without issue. However, this function was last updated in December while the failing function was last updated 2 days ago.

Edit 3: Well, in the end I just duplicated the Cloud Function and I am able to update and deploy the new one without issue. I retained the 3 day deletion for the container and this and other functions are updating without issue as well. No idea why this original function kept getting this error.

policenauts
  • 512
  • 6
  • 18
  • 1
    1) Not all answer on Stackover are good solutions. 2) Delete your rule. 3) Do not delete anything trying to fix this. 4) Redeploy your Cloud Functions app which will recreate the artifacts. – John Hanley Jan 29 '21 at 21:37
  • @JohnHanley what do you mean redeploy my cloud functions app? I've tried deploying numerous times via gcloud command line as well as manually in the UI and keep getting the same failure – policenauts Jan 29 '21 at 22:58
  • Include your deployment command and configuration in your question. For example are you deploying to the same tag you broke? Details matter when debugging problems. – John Hanley Jan 29 '21 at 23:35
  • @JohnHanley thank you, I have edited the question to include my deploy command. – policenauts Jan 30 '21 at 00:22
  • 1
    Does this answer your question? [Can I delete container images from Google Cloud Storage artifacts bucket?](https://stackoverflow.com/questions/59937542/can-i-delete-container-images-from-google-cloud-storage-artifacts-bucket) – Jan Hernandez Feb 12 '21 at 17:58

1 Answers1

2

As is recommended in the answer of the another question, it is better delete the whole bucket, this action will destroy all elements and configurations related to this bucket, avoiding issues between Functions, Storage & Container Registry, if you delete only the containers some configurations will be remained affecting further deploys.

Jan Hernandez
  • 4,414
  • 2
  • 12
  • 18