Deploy to Firebase Hosting on merge results in error - firebase

I have started to host a React app on Firebase including Github workflows (firebase-hosting-merge.yml and firebase-hosting-pull-request.yml).
While I could solve the the error in firebase-hosting-pull-request.yml using Deploy to Firebase Hosting on PR faild in github actions, I cannot solve the error ("Error: Process completed with exit code 1.") in firebase-hosting-merge.yml.
Does anybody know how to solve that?
How would I remove the workflows (as I don't really need them)? (Can I simply remove the folder ".github/workflows"?)
Code:

Related

Azure Pipline Error: Failed to get Firebase project project-name. Please make sure the project exists and your account has permission to access it

Duplicate Question: By Uber, previously asked for google-cloud-firestore
My question is Related to Deploy Firebase from Azure DevOps. I have a list of tasks in my CI Pipeline which are running fine but the one firebase publish job consistently getting failed.
Error:
Also, I have put my token inside variables
install firebase tools:
firebase publish:
How can this be solved? what I'm doing wrong here?
I think the issue comes from the usage of your variables.
See all of the variables usage:
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#runtime-expression-syntax
You can find that no usage like this:
$key
I think it should be:
$(key)
In your situation, the issue should comes from $FIREBASE_TOKEN itself was been recognized as string "$FIREBASE_TOKEN", the actual value was not pass in.

GitLab pipeline merge request failed: Invalid Firebase project selection

I've been trying to merge a source branch with a target branch, but have consistently gotten the following error message on my failed job(s):
$ firebase use project_name --token $FIREBASE_TOKEN
Error: Invalid project selection, please verify project project-name exists and you have access.
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1
I have followed the advice from this thread and logged out/in from Firebase to use the project again, which unfortunately hasn't worked:
firebase logout
firebase login
firebase use project_name
I've triple-checked that I'm using the correct project name in Firebase, rather than the name of my Gitlab repo.
Unsure if it's related, but when setting up the merge request, GitLab notes that The source branch is 3 commits behind the target branch. I don't believe this is part of the issue, but worth bringing up.
Merging branches has never been an issue until today, and this is the first time I'm seeing this particular error causing the failed jobs. Any advice is appreciated
EDIT:
I added a screenshot image of the projects list, showing I've logged into the necessary Project by Project ID on Firebase. Everything should be connected, but I can't see what I'm missing that's causing the failed jobs.
UPDATE:
I've added firebase projects:list within the pipeline editor and get the following error message.
The issue I have here is I cannot find a firebase-debug.log file, after searching ways to find it, and trying to recreate the file by commenting out # firebase-debug.log* in my .gitignore file and running firebase init to try solutions from posts like this. Any thoughts on the original merging issue or how to find firebase-debug.log to move closer to a solution are greatly appreciated.
The setup appears incorrect for CI; eg. one doesn't need to pass $FIREBASE_TOKEN.
The issue might even stem from, that you use --token once and then not anymore.
Please refer to the user manual: https://github.com/firebase/firebase-tools/#general
Using a service account might be the least troublesome.
There's also a login --reauth option; and login:ci.

Can't deploy Cloud Functions because of "Unhandled error cleaning up build images"

I've deployed hundreds of function and this is the first time I encounter this issue. Simply, it stops deploying function process, saying:
Unhandled error cleaning up build images. This could result in a small monthly bill if not corrected. You can attempt to delete these images by redeploying or you can delete them manually at https://console.cloud.google.com/gcr/images/[project-name]/us/gcf
The way I deploy is through Firebase CLI command: firebase deploy --only functions:nameOfFunction
Question is what are those images I have to delete? Why? How can I solve it?
Cloud Functions uses another product called Cloud Build to build the server images that actually get deployed. Those images are stored in Cloud Storage, and that storage is billed to your account.
Read more about it:
https://github.com/firebase/firebase-tools/issues/3404
https://krasimirtsonev.com/blog/article/firebase-gcp-saving-money
Watch:
https://www.youtube.com/watch?v=aHaI0jZ5rwM
You should be able to locate and delete the files manually in the Google Cloud console. But it sounds like there is a bug here with the files not being cleaned up automatically, so you contact Firebase support directly.
For me the issue appeared to be related to my GCF billing (https://console.cloud.google.com/billing)
I had to go to my billing account to see that my payment method was expired or something, and GCF had forecasted a monthly cost of $0.01, so deploying cloud functions was sort of locked until I updated the payment method. Then the deploy immediately worked again after updating it. The build-cleanup console warning also disappeared.
The error I was seeing in my function logs in firebase console was "billing account is not available". Which I found almost zero results for in Google. Which is why I'm posting it here.
For me, the issue was caused by a silly typo.
The error:
Functions deploy had errors with the following functions:
sendNotification(europe-west) i functions: cleaning up build files... ⚠ functions: Unhandled error cleaning up build images. This
could result in a small monthly bill if not corrected. You can attempt
to delete these images by redeploying or you can delete them manually
at...
The fix was choosing the right region.
The incorrect region:
exports.sendNotification = functions
.region("europe-west")...
The correct region:
exports.sendNotification = functions
.region("europe-west3")...
Go to https://console.cloud.google.com/apis/api/artifactregistry.googleapis.com/overview
select your project
enable Artifact Registry API
deploy functions again
In my experience going into Cloud Storage didn't solve the issue: there was no image there to be deleted.
I solved by changing the Node version, moving from 18 to 14.0.0
nvm install 14.0.0
nvm use 14.0.0
Check your Function logs, by either navigating through functions in the Firebase console or through https://console.cloud.google.com/logs
For me, the logs indicated that one of my typescript files had compiled under the wrong name and it was messing up the build.
Check the logs!
General troubleshooting tips given the variety of answers here:
if build is failing, read for other errors further up in the build output
add --debug to your CLI call, i.e.:
firebase deploy --only functions --debug
With --debug I found this in my output: "Permission 'artifactregistry.packages.delete' denied on resource"
My solution was to add Artifact Registry Administrator role to the IAM user deploying the function (in addition to Firebase Admin & Service Account User roles).

Run failed: Deploy to Firebase Hosting on merge - master

I'm doing firebase & react project.
However everytime I do git push origin master I get this email.
**
Run failed: Deploy to Firebase Hosting on merge - master
**
As I click the email and it says
**
Deploy to Firebase Hosting on merge: All jobs have failed
**
Though I get this email, it still works fine. My github gets updated fine. Also if I do firebase deploy, my website gets updated fine. Everything works just fine but getting that email.
Is that a problem?
https://firebase.google.com/docs/hosting/test-preview-deploy
I guess you have to read this one.
I know posting links ain't cool, but this is an official documentation and I believe it will stay up to date forever.
Or this one:
https://firebase.google.com/docs/hosting/github-integration
I am not really sure what your issue is.
I had a similar issue.
Firebase Hosting Setup - "Set up the workflow to run a build script before every deploy? (y/n)
I wrote npm ci && npm run generate and now it works.
npm ci is required for since your node_modules is missing in repo.
In my case I am using nuxt.js and my script is npm run generate instead or more common npm run build

Cloud Functions deployment failiure from Firebase

I seem to be unable to deploy Google Cloud Functions successfully.
I have created a project on Google Cloud Platform and then proceeded to link it to Firebase via the Firebase console. I select ADD PROJECT and Add Firebase to an existing project. Everything seems to link.
When I try to deploy a cloud function (the simple helloWorld that comes with installing firebase-tools) I keep getting deployment errors. This also happens when trying to deploy functions from Google Cloud Functions dashboard as well.
The error is something aboud setting up the environment.
After ttrying to rename the function to something else, I seem to have luck with deploying but then the function but there is a communication error Function load error: Error: cannot communicate with function.
I am unable to deploy functions on two of my projects, and firebase has been acting very strangely in the last few days, so can somebody please tell me if I am doing something wrong or is it a Firebase glitch
Maybe because there is an outage starting from early this morning. Check status here: https://status.firebase.google.com

Resources