Firebase deploy functions fails
Asked by Javier Mart?n:

After updating firebase-functions to 4.0.0 or 4.0.1, trying to deploy my functions with the firebase CLI is success.

But with de pipeline, firebase-deploy version 2.0.0 it seems is not detecting my functions folder and return me an error saying me that non-interactive is not able to delete my functions (and a list of all my functions).

Reverting the update from firebase-functions 4.0.1 to the last 3.x version, is it working again without any issues.


Answers:
author: Igor Stoyanov
body: [@Javier Mart?n](/t5/user/viewprofilepage/user-id/5058968) hi. We released a new[firebase-deploy pipe version 3.0.0](https://bitbucket.org/atlassian/firebase-deploy/src/3.0.0/) with firebase-tools 11.  

Regards, Igor

comments: author: Javier Mart?n
body: Working perfect, thank you!


author: Engine Irie
body: How to install it ?


author: Igor Stoyanov
body: [@Engine Irie](/t5/user/viewprofilepage/user-id/5296888) hi. Check [this article.](https://support.atlassian.com/bitbucket-cloud/docs/what-are-pipes/)  

Regards, Igor


author: Igor Stoyanov
body: [@Javier Mart?n](/t5/user/viewprofilepage/user-id/5058968) hi. We need more information.

Could you share your pipeline configuration and log output for a new and old version of the pipe?

Regards, Igor

comments: author: Javier Mart?n
body: - step:  
name: Install dependencies and build  
script:  
- npm install  
- npm run build:prod  
artifacts:  
- node_modules/\*\*  
- dist/\*\*

- step:  
name: Deploy to Firebase  
script:  
- cd functions \&\& npm install  
- pipe: atlassian/firebase-deploy:2.0.0  
variables:  
KEY_FILE: $KEYFILE_PROD  
PROJECT_ID: $FIREBASE_PROD


author: Javier Mart?n
body: Old version:

mkdir : /usr/local/n/versions/node/16.18.0  
fetch : <https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.gz>  
installed : v16.18.0 (with npm 8.19.2)  
INFO: Starting deployment of the project to Firebase.  
=== Deploying to 'projectNameHere'...  
i deploying storage, firestore, functions, hosting  
Running command: npm --prefix "$RESOURCE_DIR" run lint  
\> lint  
\> eslint .  
? functions: Finished running predeploy script.  
i firebase.storage: checking storage.rules for compilation errors...  
? firebase.storage: rules file storage.rules compiled successfully  
i firestore: reading indexes from firestore.indexes.json...  
i cloud.firestore: checking firestore.rules for compilation errors...  
? cloud.firestore: rules file firestore.rules compiled successfully  
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...  
i functions: ensuring required API cloudbuild.googleapis.com is enabled...  
? functions: required API cloudfunctions.googleapis.com is enabled  
? functions: required API cloudbuild.googleapis.com is enabled  
i functions: preparing codebase default for deployment  
? functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.  
? functions: Please note that there will be breaking changes when you upgrade.  
i functions: preparing functions directory for uploading...  
i functions: packaged /opt/atlassian/pipelines/agent/build/functions (3.09 MB) for uploading  
i functions: ensuring required API cloudscheduler.googleapis.com is enabled...  
i functions: ensuring required API cloudtasks.googleapis.com is enabled...  
? functions: required API cloudscheduler.googleapis.com is enabled  
? functions: required API cloudtasks.googleapis.com is enabled  
i storage: latest version of storage.rules already up to date, skipping upload...  
i firestore: latest version of firestore.rules already up to date, skipping upload...  
? firestore: deployed indexes in firestore.indexes.json successfully  
? functions: functions folder uploaded successfully  
i hosting\[projectNameHere\]: beginning deploy...  
i hosting\[projectNameHere\]: found 39 files in dist  
i hosting: adding files to version \[0/39\] (0%)  
i hosting: uploading new files \[9/11\] (81%)  
? hosting\[projectNameHere\]: file upload complete  
? storage: released rules storage.rules to firebase.storage  
? firestore: released rules firestore.rules to cloud.firestore  
i functions: updating Node.js 16 function backup-create(europe-west3)...  
i functions: updating Node.js 16 function certifications-create(europe-west3)...  
i functions: updating Node.js 16 function certifications-uploaded(europe-west3)...  
i functions: updating Node.js 16 function records-files-create(europe-west3)...  
i functions: updating Node.js 16 function notifications-create(europe-west3)...  
i functions: updating Node.js 16 function notifications-read(europe-west3)...  
i functions: updating Node.js 16 function procedures-create(europe-west3)...  
i functions: updating Node.js 16 function procedures-change-status(europe-west3)...  
i functions: updating Node.js 16 function procedures-update(europe-west3)...  
i functions: updating Node.js 16 function blockchain-listenerActions(europe-west3)...  
i functions: updating Node.js 16 function users-create(europe-west3)...  
i functions: updating Node.js 16 function users-disable(europe-west3)...  
i functions: updating Node.js 16 function users-update-info(europe-west3)...  
i functions: updating Node.js 16 function users-update-email(europe-west3)...  
i functions: updating Node.js 16 function help-form(europe-west3)...  
i functions: updating Node.js 16 function blockchain-listener(europe-west3)...  
i functions: updating Node.js 16 function blockchain-retry(europe-west3)...  
i functions: updating Node.js 16 function blockchain-sendTransaction(europe-west3)...  
? functions\[blockchain-listener(europe-west3)\] Successful update operation.  
? functions\[backup-create(europe-west3)\] Successful update operation.  
? functions\[blockchain-retry(europe-west3)\] Successful update operation.  
? functions\[blockchain-sendTransaction(europe-west3)\] Successful update operation.  
? functions\[certifications-create(europe-west3)\] Successful update operation.  
? functions\[help-form(europe-west3)\] Successful update operation.  
? functions\[users-disable(europe-west3)\] Successful update operation.  
? functions\[users-create(europe-west3)\] Successful update operation.  
? functions\[notifications-read(europe-west3)\] Successful update operation.  
? functions\[users-update-info(europe-west3)\] Successful update operation.  
? functions\[procedures-update(europe-west3)\] Successful update operation.  
? functions\[certifications-uploaded(europe-west3)\] Successful update operation.  
? functions\[users-update-email(europe-west3)\] Successful update operation.  
? functions\[procedures-change-status(europe-west3)\] Successful update operation.  
? functions\[procedures-create(europe-west3)\] Successful update operation.  
? functions\[notifications-create(europe-west3)\] Successful update operation.  
? functions\[records-files-create(europe-west3)\] Successful update operation.  
? functions\[blockchain-listenerActions(europe-west3)\] Successful update operation.  
Function URL (procedures-change-status(europe-west3)): <https://europe-west3-projectNameHere.cloudfunctions.net/procedures-change-status>  
i functions: cleaning up build files...  
i hosting\[projectNameHere\]: finalizing version...  
? hosting\[projectNameHere\]: version finalized  
i hosting\[projectNameHere\]: releasing new version...  
? hosting\[projectNameHere\]: release complete  
? Deploy complete!


author: Igor Stoyanov
body: .


author: Javier Mart?n
body: For new version, wait a moment, I will make a deployment in a few minutes


author: Javier Mart?n
body: New version output:

Digest: sha256:450c901c08b42fb224428c4de3903aa06ac76bcfa0277e109a92c7c11677528c  
Status: Downloaded newer image for bitbucketpipelines/firebase-deploy:2.0.0  
INFO: Executing the pipe...  
INFO: Current NodeJS version:  
installing : node-v16.18.0  
mkdir : /usr/local/n/versions/node/16.18.0  
fetch : <https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.gz>  
installed : v16.18.0 (with npm 8.19.2)  
INFO: Starting deployment of the project to Firebase.  
=== Deploying to 'projectNameHere'...  
i deploying storage, firestore, functions, hosting  
Running command: npm --prefix "$RESOURCE_DIR" run lint  
\> lint  
\> eslint .  
? functions: Finished running predeploy script.  
i firebase.storage: checking storage.rules for compilation errors...  
? firebase.storage: rules file storage.rules compiled successfully  
i firestore: reading indexes from firestore.indexes.json...  
i cloud.firestore: checking firestore.rules for compilation errors...  
? cloud.firestore: rules file firestore.rules compiled successfully  
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...  
i functions: ensuring required API cloudbuild.googleapis.com is enabled...  
? functions: required API cloudbuild.googleapis.com is enabled  
? functions: required API cloudfunctions.googleapis.com is enabled  
i functions: preparing codebase default for deployment  
i storage: latest version of storage.rules already up to date, skipping upload...  
i firestore: latest version of firestore.rules already up to date, skipping upload...  
? firestore: deployed indexes in firestore.indexes.json successfully  
i hosting\[projectNameHere\]: beginning deploy...  
i hosting\[projectNameHere\]: found 39 files in dist  
i hosting: adding files to version \[0/39\] (0%)  
i hosting: uploading new files \[10/12\] (83%)  
? hosting\[projectNameHere\]: file upload complete  
? storage: released rules storage.rules to firebase.storage  
? firestore: released rules firestore.rules to cloud.firestore  
Error: The following functions are found in your project but do not exist in your local source code:  
backup-create(europe-west3)  
blockchain-listener(europe-west3)  
blockchain-listenerActions(europe-west3)  
blockchain-retry(europe-west3)  
blockchain-sendTransaction(europe-west3)  
certifications-create(europe-west3)  
certifications-uploaded(europe-west3)  
help-form(europe-west3)  
notifications-create(europe-west3)  
notifications-read(europe-west3)  
procedures-change-status(europe-west3)  
procedures-create(europe-west3)  
procedures-update(europe-west3)  
records-files-create(europe-west3)  
users-create(europe-west3)  
users-disable(europe-west3)  
users-update-email(europe-west3)  
users-update-info(europe-west3)  
Aborting because deletion cannot proceed in non-interactive mode. To fix, manually delete the functions by running:  
firebase functions:delete backup-create --region europe-west3  
firebase functions:delete blockchain-listener --region europe-west3  
firebase functions:delete blockchain-listenerActions --region europe-west3  
firebase functions:delete blockchain-retry --region europe-west3  
firebase functions:delete blockchain-sendTransaction --region europe-west3  
firebase functions:delete certifications-create --region europe-west3  
firebase functions:delete certifications-uploaded --region europe-west3  
firebase functions:delete help-form --region europe-west3  
firebase functions:delete notifications-create --region europe-west3  
firebase functions:delete notifications-read --region europe-west3  
firebase functions:delete procedures-change-status --region europe-west3  
firebase functions:delete procedures-create --region europe-west3  
firebase functions:delete procedures-update --region europe-west3  
firebase functions:delete records-files-create --region europe-west3  
firebase functions:delete users-create --region europe-west3  
firebase functions:delete users-disable --region europe-west3  
firebase functions:delete users-update-email --region europe-west3  
firebase functions:delete users-update-info --region europe-west3  
? Deployment failed.


author: Javier Mart?n
body: The only difference between two outputs is changing in functions/package.json:

firebase-functions from

"firebase-functions": "\^3.24.1",

to

"firebase-functions": "\^4.0.1",


author: Igor Stoyanov
body: I am not very familiar in firebase but could you check this articles to confirm your case is not one of these:

* <https://stackoverflow.com/questions/62293474/firebase-doesnt-deploy-new-function-because-it-cant-delete-old-function-cant>
* <https://stackoverflow.com/questions/58853149/cli-question-the-following-functions-are-found-in-your-project-but-do-not-exis>

Regards, Igor


author: Igor Stoyanov
body: Also in the the pipe we use firebase-tools@10.\* , could we swap your local firebase CLI to that version to see if you have the same error?


author: Javier Mart?n
body: That is not my case and using de deploy comand in my local computer, the functions are deploying without issues.

I'm using firebase-tools 11.15.0

I will check with 10\* version


author: Javier Mart?n
body: Deployment with firebase-tools 10.3.0 is reproducing the same issue in my local CLI, so the problem is the outdated firebase-tools version in pipeline deploy


author: Igor Stoyanov
body: [@Javier Mart?n](/t5/user/viewprofilepage/user-id/5058968) we will perform update and notify you when new version will become available.

Regards, Igor


author: Javier Mart?n
body: Thank you!


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

deployment

firebase

google