404 Error on firebase deploy after adding target - firebase

I added target to firebase project because there is going to be subdomains. I've done this before, but never encountered this error. So I created the project in the firebase console. Then I opened the project in my terminal.
firebase init
... chose existing project // Website
firebase deploy // website is now live at firebase domain
Then I added a target...
firebase target:apply hosting website Website
Now I went to my firebase.json file and it looks like this
{
"hosting": {
"target": "website" // this causes Error: 404, Requested entity was not found
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
I'm getting the error after I add that target and run firebase deploy in the terminal. Maybe I need to add the target to my firebase.rc as well?

Related

Firebase Deploy Link shows Blank or Deploy complete

`
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
`Have an issue where the Firebase deploy link shows "Firebase Hosting Setup Complete." I've tried just about everything on stackoverflow with no success.
I have it set to "build" not "public" in my firebase.json for hosting and it's not doing anything.
I've tried messing with the index.html but then the screen just comes up white/blank.
I've also deleted firebase files completely and started the init over. Still comes back the same.
Has anyone else ran into this lately?
It's hard to tell without any code snippets or firebase config files but I believe if you specify your public location as "build" you do not need to include the rewrites property in the firebase.json file. According to The Docs,
Set up rewrites for any of these purposes:
Show the same content for multiple URLs. Learn how.
Serve a function or access a Cloud Run container from a Hosting URL. Learn how: function or container.
Create a custom domain Dynamic Link. Learn how.

Not sure why my Vue app build.js file appears to be my index.html file after build in Firebase

After I deploy my Vue app to Firebase, it appears as if my build.js file is the same as my index.html file. When I go the site, I get nothing. Looking the the console, I get an error Uncaught SyntaxError: Unexpected token < at line 1 of build.js.
If I then reload it with the Network tab open, I see build.js listed as a resource, but when I click on it, it shows the same contents as index.html. (The build.js file is in fact js after I build it on my end).
This is my first time using Firebase, so I'm not sure if I'm doing something wrong in the firebase.json (which I just copied from a tutorial):
{
"hosting": {
"public": "./dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"source": "**",
"destination": "/index.html"
}]
}
}
I'm not using any other firebase tools.
Thanks for any insight.
you firebase.json should look like this:
hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
Run firebase deploy --only hosting and it should be good. Source here
Make sure your output for that command looks something like this:
=== Deploying to 'your-project-name'...
i deploying hosting
i hosting[zero-to-prod-test]: beginning deploy...
i hosting[zero-to-prod-test]: found 16 files in public/build <---- THIS TELLS YOU IF THE FILES ARE BEING COPIED
✔ hosting[zero-to-prod-test]: file upload complete
i hosting[zero-to-prod-test]: finalizing version...
✔ hosting[zero-to-prod-test]: version finalized
i hosting[zero-to-prod-test]: releasing new version...
✔ hosting[zero-to-prod-test]: release complete
That way to can debbug is something is wrong on the data transfer.
On your case your index.html is pointing to dist/build.js intead of /build.js that is causing the problem, so it doesnt look like a firebase problem but a webpack problem. Check your assets generation process.

Firebase Hosting Vue.js net::ERR_ABORTED

I am trying to host my Vue.js app on Firebase and have been running into problems. I can run the app fine locally on my machine but when I deploy to Firebase Hosting, index.html seems to load but the files under /static don't seem to load.
I get the following error message:
GET
https://hostname.com/static/css/app.f6523a21105b673f23ff46cfd6d47a69.css
net::ERR_ABORTED 404
My firebase.json :
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{ "source": "/notification", "function": "handleCalendarNotification"},
{ "source": "/viewTask/**", "destination": "/dist/index.html"}
]
}
My vue.js application uses the /viewTask rewrite.
Any ideas?
I contacted Firebase support and it turns out that this was a Firebase problem and not a problem with my code. They have fixed it and it is working fine now.

Unable to deploy firebase project to custom domain

Took a free domain on freenom
Linked it successfully with a project on firebase
Added a target name to the domain
Added the target to
firebase.json
on running firebase deploy
Error : HTTP Error 404
Could someone point out what i'm doing wrong cause I followed all the steps on the firebase website but still am unable to get it running. The HTML file I want to host just has a H1 tag with "Hello World".
You do not require any special steps to deploy the site on custom website. Once your site is up on the default domain. Then the website gets automatically replicated on you connected custom domain. Hope this helps you.
This is my firebase.json file:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}

Why am I seeing this image instead of my static firebase website?

I expecting see my firebase website but instead of the web app, I seeing this image. I think I followed the Firebase Hosting docs.
Here's my firebase.json:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
After running firebase deploy, it says:
Deploy complete!
What did I miss? :(
Thanks,
Adi
This is infact your website. When you run Firebase init it prepopulates the public folder (which you selected to be your dist directory) with the sample site you are seeing. You must place all of your HTML, CSS, and JavaScript into the dist directory and the run firebase deploy --only hosting

Resources