When deploying a simple hello_world app to Google Cloud Functions using gcloud, I get the following error message:
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Build error details not available
It took me quite a while to figure out that this is due to my .cloudignore file:
.cloudignore
# Ignore everything
*
# Except these files:
!main.py
!requirements.txt
What seems to be the problem with this file? And what is a better way achieve what I want, i.e. ignore all files except main.py and requirements.txt?
Any hints are greatly appreciated!
The
.gcloudignorefile follows the same pattern as the.gitignore. Considering that, using only the*, could ended up being a recursively method that would ended up messing the other files that would be excepted.Considering that, I would recommend you to give a try using the below configuration for your
.gcloudignorefile - this way, the slash should eliminate this undesired behavior:A reminder is that the file needs to be in the same directory that the
main.pyandrequirements.txtfile are, so the path works correctly. Otherwise, you will need to set the whole path in the.gcloudignore.In these below posts from the Community - on specific regarding GCP and other on
.gitignore- that might help you, since the syntax for both of them are the same and there are some other options and ideas on how to achieve it.gcloud app deploy?Let me know if the information helped you!