ERROR: gcloud functions deploy Error: go: error loading module

Cloud functions can use go modules or vendor. The vendor method is preferred because private repos are easily packaged.
If you have intended to use vendor but use go mod, you MUST .gcloudignore the go.mod & go.sum files.

The .cloudignore should stay in the same directory from where you are invoking gcloud functions deploy.

$ cat .gcloudignore
# This file specifies files that are *not* 
# uploaded to Google Cloud Platform using gcloud. 
# For more information, run:
#   $ gcloud topic gcloudignore



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: