Description
[REQUIRED] Environment info
firebase-tools: 11.3.0
Platform: Windows
[REQUIRED] Test case
Possibly related to #4770.
I upgraded a function from v1 to v2 and tried to deploy it, but the deploy failed with Error: Pass the --force option to deploy functions that increase the minimum bill
. However, the function was created on Firebase without a trigger, and all subsequent attempts to redeploy, even after downgrading the function to v1, fail with Error: An unexpected error has occurred.
. Running with --debug gives:
[2022-07-31T21:45:23.477Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v2alpha/projects/gunnwatt/locations/-/functions [none]
[2022-07-31T21:45:24.205Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2alpha/projects/gunnwatt/locations/-/functions 200
[2022-07-31T21:45:24.206Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2alpha/projects/gunnwatt/locations/-/functions {"functions":[{"name":"projects/gunnwatt/locations/us-central1/functions/api","buildConfig":{"build":"projects/108805079121/locations/us-central1/builds/51bcc649-8ec1-4e2b-af37-5d8c1ca3b4ec","runtime":"nodejs14","entryPoint":"api","source":{"storageSource":{"bucket":"gcf-v2-sources-108805079121-us-central1","object":"api/function-source.zip"}},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-108805079121-us-central1","object":"api/function-source.zip","generation":"1659293271683162"}}},"state":"FAILED","updateTime":"2022-07-31T18:49:52.861395303Z","labels":{"deployment-tool":"cli-firebase"},"stateMessages":[{"severity":"ERROR","type":"CloudRunServiceNotFound","message":"Cloud Run service projects/gunnwatt/locations/us-central1/services/api for the function was not found. The function will not work correctly. Please redeploy."}],"environment":"GEN_2"}]}
[2022-07-31T21:45:24.368Z] TypeError: Cannot read properties of undefined (reading 'service')
at C:\Users\Kevin\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\backend.js:197:113
at Array.map (<anonymous>)
at loadExistingBackend (C:\Users\Kevin\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\backend.js:197:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.existingBackend (C:\Users\Kevin\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\backend.js:173:9)
at async Promise.all (index 1)
at async Command.actionFn (C:\Users\Kevin\AppData\Roaming\npm\node_modules\firebase-tools\lib\commands\functions-delete.js:34:39)
Error: An unexpected error has occurred.
The function cannot be deleted using the Firebase console and all attempts to redeploy or do firebase functions:delete api
are met with the above error, essentially soft locking deployment.
[REQUIRED] Steps to reproduce
Run
firebase deploy --only functions
with the above configuration of v1 and v2 functions.
[REQUIRED] Expected behavior
Reverting to a v1 function should resolve deployment issues.
[REQUIRED] Actual behavior
The deploy still fails.