I was hosting a Flutter Web project using Firebase Hosting.
I did firebase init then firebase deploy but my hosted website looks like this:
I think you also this kind of error while hosting.
Answering my own question as I didn't find an answer that helped me out. So I found a way out.
After doing firebase init and selecting a few options as per you choice, firebase creates a firebase.json file which looks like this:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
If you do firebase deploy here, you'll be seeing the same website as shown in the question.
Here's what you can do to avoid it.
STEP1: flutter clean
STEP2: flutter build web
STEP3: firebase init
STEP4: Now before doing firebase deploy, make sure you change the "public" directory to "build/web" as shown below, as that is the web flutter has built.
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
I hope this answer helped you out. Peaceā
Related
`
{
"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.
I'm trying to verify the domain for Apple Developer, who require the verifiable location to be:
https://[website name].com/.well-known/apple-developer-merchantid-domain-association.txt
The trouble is coming in at the '/.well-known/' segment, I've written the directory as '\.well-known' which works but when I deploy hosting to update the files on my website I can't find it.
I've taken out the "**/.*" from ignore, so it doesn't ignore files with a full stop in. Here's what's left in case I've missed anything:
"hosting": {
"site": "[website name]",
"public": "public",
"cleanUrls": true,
"ignore": [
"firebase.json",
"**/node_modules/**"
]
}
}
Is there something I'm missing?
I solved it by using mkdir to create a hidden folder called '.well-known' in the terminal and showing hidden folders.
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?
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"
}
]
}
}
I'm following this tutorial Getting Started with Firebase Hosting on the Web - Firecasts
I'm trying to host a simple index.html file in firebase but when I type firebase deploy its gives me the following error:
No targets found. Valid targets are: database,storage,functions,hosting. hosting error image
I found my firebase.json file is empty it contains only { } .
run firebase init again.
When you are asked for - Which Firebase CLI features do you want to setup for this folder?
Press Space to select features, it will mark that feature with asterisk.
Then Enter to confirm your choices.
Make sure you select the options by pressing spacebar, then press enter.
run firebase init and if your firebase.json is empty with only {} then add
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
replace "public": "app" with "public": "public"
then run firebase deploy