skip to Main Content

Recently our ability to deploy our functions, both in our dev and prod projects, ceased. When I attempt to deploy any function, or, via cloudbuild trigger, deploy all functions, I get an error:

Build failed: > [email protected] build
> yarn build-deps && tsc

sh: 1: yarn: not found; Error ID: 1a2262f3

[email protected] is the package in our repo. yarn build-deps && tsc is our package.json script called "build" .

  1. this just started happening. There were two things that were happening at the same time:
    • we suddenly used a LOT of storage, in one of our GCS buckets. This GCS bucket usage doesn’t seem related.
    • we attempted to redeploy one of the functions while it was being called with high frequency, with result that the deployment failed. But now it seems we cannot deploy any function.
  2. This error is occurring in the functions deployment cloud — not as part of our build, either local or GCB. It is during a functions.v1.OperationMetadataV1 UPDATE_FUNCTION. So, like, why is the function deployment running an npm build ?

2

Answers


  1. Chosen as BEST ANSWER

    There was a breaking change where deploying would cause the package.json build script to be run. And apparently yarn is not installed by default.

    https://cloud.google.com/functions/docs/release-notes#April_11_2023


  2. Yarn is used if your project includes a yarn.lock file.

    Npm run build is run in default whenever a script is specified inside the package.json file. You can override this and only run your preferred scripts using custom build steps. You can use the GOOGLE_NODE_RUN_SCRIPTS
    environment variable or gcp-build in your package.json file, these will control what scripts run. You can also specify one or more scripts, or instead pass an empty environment variable to prevent the default behaviour from running,GOOGLE_NODE_RUN_SCRIPTS=

    For more information, you may refer to this document.

    You may also check this possible related issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search