Run failed: Deploy to Firebase Hosting on merge - master - firebase

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

Related

Multi environment setup for firebase not deploying as expected

So, I'm helping someone out with a project which is developed by someone else, but he left. Well, not too relevant but I'm struggling to get a multi environment setup running. Hopefully someone can push me in the right direction.
In the beginning there was one environment. Only production. But for the changes I want an environment running next to the production env. This will be staging.
I have been searching the web on how to set this up and I got something working. It seems to deploy everything, however the changes are not visible on the staging environment.
This is what I have right now in my readme:
#### Deploy to staging
Build the application: `npm run build`
Make sure you are at the correct environment: `firebase use staging`
And apply the target (??) ; `firebase target:apply hosting staging exp-game-staging`
Now you can deploy with:
Initially, for fresh deploy: `firebase deploy`
And later for consequent deployments: `firebase deploy --only hosting`
This gives met the following output:
=== Deploying to 'exp-game-staging'...
i deploying hosting
i hosting[exp-game-staging]: beginning deploy...
i hosting[exp-game-staging]: found 739 files in dist/exp-game-staging
✔ hosting[exp-game-staging]: file upload complete
i hosting[exp-game-staging]: finalizing version...
✔ hosting[exp-game-staging]: version finalized
i hosting[exp-game-staging]: releasing new version...
✔ hosting[exp-game-staging]: release complete
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/***/overview
Hosting URL: https://***.web.app
For the files this seems to work, but it's still using the production database from the staging environment. Locally tho, this is not the case and when I'm developing locally it's using the staging database as expected.
Does anyone know what I'm missing here?
I understand that you are trying to create two environments one for Production and the other for Staging in your Firebase project, but you are having the issue that the staging stage is using the database from the production environment.
Make sure to refer to the steps mentioned in the documentation when you create the two separate environments. Also, the recommendation is to create separate databases for both the environments.
You can achieve this by taking a backup of the data to a storage bucket, and then restore it from there into the other database.
Also, you may refer to this Firestore backup/export/import info here.
If you're using Firebase RTDB, and not Firestore - this documentation might help.

Angular Universal + Firebase cloud functions deployment issue

I've been stuck on this issue for some time now.
My Angular project version is 9.0.3.
The #angular/fire version is 6.1.4
I have followed the guide here
The project builds and renders for the local Express server I have.
The problem occurs when I deploy the project to Firebase with a cloud function that will render the application.
Running the command ng deploy gives the below error
Error: ENOENT: no such file or directory, open '/home/teebo/Development/motf/dist/motif/browser/index.html'
This issue is linked to a reported issue here
I have investigated and found that in the project's dist folder, a index.original.html file is generated instead of index.html.
I have opened an issue here with no feedback from the maintainers.
If there is anything I am missing or there's something I can do to circumvent this issue, please share and any suggestions are appreciated.
Any suggestion, comment, anything.
I have found a way to circumvent this issue.
This is not a proper solution for the ng deploy issue but at least I can deploy the ssr function.
Because my dist folder is nested in another dist folder (Which does not include the browser build folder), that is why I was getting the error when running ng deploy. Below are steps I've followed to at least be able to deploy.
Run ng deploy (It will error out with the above error but will build the app and create a dist folder).
Copy the browser folder to the dist folder that does not have it (In my case I have copied it to a dist folder one level up).
Deploy the ssr function by running firebase deploy --only functions:ssr (You can change functions:ssr to whatever name you have named your function).
This worked for me;
It would save time to write an npm script to do all this but then; I am not sure if my firebase/universal config is wrong or there is a bug with #angular/fire.

firebase deploy not working even though firebase init command has worked

I'm a newbie in programming and still learning some stuff (i use windows btw).
i try to make an app, connect it to firebase. after setting up everything its time to setting the CLI
good news : i successfully setting up everything from node to nvm until successfully launch the login in CLI.
bad news : right after successfully login the CLI, i'm trying to type in the cmd
firebase deploy --only function
and this error appear
Error: not in a Firebase app directory (could not locate firebase.json)
i already search the web for the solution, but i found nothing.
can someone tell me did i miss something ?

Firebase Hosting and Github Action error "auth/invalid-api-key"

I'm using React for my project along with Firebase. Using Github Actions my code is successfully deployed to firebase.
But when I visit the hosted URL It gives me an error in the console saying
"Your API key is invalid, please check you have copied it correctly."
However when I deploy from the local system directly using firebase deploy It works fine.
I have taken the required care of my environment variables. But nothing seems to work.
It seems there is some problem while GitHub actions deploy the changes to firebase. Though all the build pass it gives me an error as stated above. Please Help.
This happen because GitHub actions don't have access to your .env on your local machine, you need to configure that on "GitHub Secrets" and put on your yml file.

How long it takes for a firebase hosting to work?

I followed the instructions, and deployed a simple web yesterday. At first, it kept showing the default website, saying " you've deployed successfully...", not my web.
Also, the 'firebase open' command + "Hosting: Deployed Site" leads to a undefined site:' undefined.firebaseapp.com '.
But, magically, about an hour later when I open the link from 'firebase console' again, the web showed up... I am not sure whether 'firebase open' command worked cause I didn't try.
Today, I added some features, and deployed again. In the firebase CLI, it said deployed. But, the link still showed the old version.
I'll catch up an hours later to see whether it works, but even it works, it takes too long.
has anyone had the same experience? what's wrong with my web?
Thanks.
This is how I solved this issue for my angular 7 app deployment on Firebase hosting:
ng build --prod
go to dist/myproject and run command Firebase init and...
I went to dist/myproject that now contain build files along with Firebase related files. Copy all files except Firebase related files to dist folder in side dist/myproject.
there you will get overwrite warning just select overwrite option.
after copy process completes, run command Firebase deploy.
after completion of process go to shown URL and there you will find your running app.

Resources