firebasegoogle-cloud-functions

functions deployment fails: yarn: not found


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: > functions@0.1.0 build
> yarn build-deps && tsc

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

functions@0.1.0 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 ?

Solution

  • 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