Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: (gcloud.functions.deploy) message=Build failed: function.js does not exist

I am trying to deploy a simple function in Cloud Builds through a yaml file. This function lives in Github and the Cloud Build trigger point at my repository in order to deploy it. Cloud Build invokes my yaml file without problems but suddenly I get this error

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: function.js does not exist; Error ID: 7485c5b6

I am not sure why gcloud function deploy is looking for a function.js file when as far as I understand, it just searches for the index.js file. The files that I have are:

  • index.js
  • cloudbuild.yaml
  • package.json
  • package-lock.json

The function deploys successfully through gcloud cli so my bet is that the error exists in the yaml file but it might also be some config in Cloud Build. Here how yaml file looks:

steps:
  - name: "gcr.io/cloud-builders/gcloud"
    args:
      - functions
      - deploy
      - webhook
      - --source=.
      - --trigger-http
      - --runtime=nodejs12
      - --region=europe-west2
      - --allow-unauthenticated

Have somebody any clue of what could be happening? thanks!

like image 896
AudronFS Avatar asked Oct 28 '25 15:10

AudronFS


1 Answers

The error have been solved installing npm. Adding this to yaml file:

steps:
  - name: "gcr.io/cloud-builders/npm"
    args: ["install"]
    dir: "YOUR_PATH"
like image 61
AudronFS Avatar answered Oct 30 '25 06:10

AudronFS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!