EEEEH
EEEEH

Reputation: 779

Google Cloud Function Build failed. Error ID: 99f2b037

Build failed when I try to update code and re-deploy the Google Cloud Function.

Deploy Script:

gcloud functions deploy <my-func-name> --entry-point <my-entry-point> \
--runtime python37 \
--trigger-http \
--region=asia-east2 \
--memory=8192 \
--timeout=540

Error Message:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: 
/layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' 
(AttributeError: module '__main__' has no attribute '__file__'); Error ID: 99f2b037

Source code structure:

.
├── lib
│   ├── __init__.py
│   └── azsync.py
├── main.py
└── requirements.txt

Requirements.txt:

flask==1.0
gcsfs==0.4.0
pandas==0.25.0
azure-storage-blob==12.0.0

Upvotes: 2

Views: 1773

Answers (2)

Gourav B
Gourav B

Reputation: 972

With the provided requirements.txt and the gcloud deploy command, I deployed a sample Cloud Function, and it worked fine.

So, I believe the issue is with one of your .py code files.

To troubleshoot further, you can go to the below URL:

https://console.cloud.google.com/cloud-build/builds;region=asia-east2?project=<PROJECT_ID>

And then select the failed Build to browse its logs, and view the error message in detail.

Upvotes: 1

Divyani Yadav
Divyani Yadav

Reputation: 1142

The release of setuptools 60.3.0 caused AttributeError because of a bug and now Setuptools 60.3.1 is available. You can refer to the GitHub Link here.

For more information you can refer to the stackoverflow answer as :

If you run into this pip error in a Cloud Function, you might consider updating pip in the "requirements.txt" but if you are in such an unstable Cloud Function the better workaround seems to be to create a new Cloud Function and copy everything in there.

The pip error probably just shows that the source script, in this case the requirements.txt, cannot be run since the source code is not fully embedded anymore or has lost some embedding in the Google Storage. or you give that Cloud Function a second chance and edit, go to Source tab, click on Dropdown Source code to choose Inline Editor and add main.py and requirements.txt manually (Runtime: Python).”

Upvotes: 1

Related Questions