3

I have a Running Google Function which I use in my code and it works fine. But when I go to Google function to see the source code it shows: Archive not found in the storage location Why Can't I see my source code? What should I do?

Runtime: Node.js 10

Donnald Cucharo
  • 3,866
  • 1
  • 10
  • 17
Shima K
  • 73
  • 2
  • 2
  • 12

2 Answers2

2

There are two possible reasons:

  1. You may have deleted the source bucket in Google Cloud storage. Have you perhaps deleted GCS bucket named like gcf-source-xxxxxx? It is the source storage where your code is archived. If you are sure you have deleted the source bucket, There is no way to restore your source code.

  2. Much more likely, though, is that you did not delete anything but instead renamed the bucket, for example by choosing a near city for the location settings. If the GCS bucket's region does not match your Cloud function region, the error is thrown. You should check both services' region.

    You can check the Cloud Function's region at details -> general information

    enter image description here

questionto42
  • 7,175
  • 4
  • 57
  • 90
SeungwooLee
  • 959
  • 3
  • 12
  • Thank you for your answer, I checked my buckets region which is (us-central1(lowa)), and the google function is also (us-central1). So if I had deleted the source bucket, should I rewrite the google function again or it will work ok? (if I don't have a plan to change the original source code) – Shima K Dec 18 '20 at 16:26
  • Have you checked the bucket named gcf-source-xxxx doesn't exist? If sure, delete not working cloud function. and recreate same function. Then it will work fine. – SeungwooLee Dec 19 '20 at 02:19
1

This error had appeared before when I browsed the Google Storage location that is used by the cloud function - without deleting anything there. It might have happened, though, that I changed the location / city of the bucket to Region MY_REGION (MY_CITY). In my case, the CF was likely already at the chosen region, therefore the other answer above, bullet point 2., probably does not cover the whole issue. I guess it is about a third point that could be added to the list:

+ 3. if you firstly choose a region at all, the bucket name gets a new suffix that was not there before, that is, from gcf-sources-XXXXXXXXXXXX to gcf-sources-XXXXXXXXXXXX-MY_REGION. Then, the CF is not be able to find its source code anymore in the old bucket address. That would explain this first error.

First error put aside, now the error in question appears again, and this time I have not done anything to get Google app engine deployment fails- Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__'). I left it for two days, doing anything, only to get the error in question afterwards. Thus, you seem to sometimes just lose your deployed script out of nowhere, better keep a backup before each deployment.

Solution:

  • Create a new Cloud Function or
  • edit the Cloud Function, choose Inline Editor as source code, create the default files for Runtime Node.js 10 manually and fill them with your backup code.
questionto42
  • 7,175
  • 4
  • 57
  • 90