17

i have hosted a static website on firebase and i am using node.js. when i am trying to deploy my website i am facing this error.

 C:\Users\Ankur-PC\Desktop>firebase deploy

=== Deploying to 'wo*****win'...

i  deploying hosting

**Error: HTTP Error: 404, Requested entity was not found.**

i was also trying these cmd to resolve this error

npm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools

10 Answers10

49

I had to add site property to firebase.json to fix this.

{
  "hosting": {
    "site": "my-app-id",
    "public": "app",
    ...
    ...
}
Lahiru Chandima
  • 22,324
  • 22
  • 103
  • 179
5

You have to make sure that you have a Web app added in your Firebase console.

enter image description here

Then, go to Build -> Hosting and set that up. You'll be prompted to add a name for your site. Copy what you type in the box here...

enter image description here

...and add it to your firebase.json file here:

"hosting": {
"site": "stack-overflow-example", // here
"public": "build/web",
"rewrites": [
  {
    "source": "**",
    "destination": "/index.html"
  }
]
}
Code on the Rocks
  • 11,488
  • 3
  • 53
  • 61
  • If you have followed the documentation and still have this issue, then this is the correct answer. – DavidP Jun 12 '22 at 12:34
2

update your Firebase npm package to latest version . It works for me

npm install -g firebase-tools

1

Unless the source of your website is in C:\Users\Ankur-PC\Desktop , you are executing the command in the wrong directory

try to cd [source dir] and then deploy

giulp
  • 2,200
  • 20
  • 26
0

If you have a redirect to a Cloud Run or Cloud Function, make sure it's running.

Mathias Bak
  • 4,687
  • 4
  • 32
  • 42
0

It happened to me when I initiate the project in CLI, and THEN setup a second hosting in the same project.

The solution is to edit the firebase.json and adding the new hosting you wish to deploy:

{
  "hosting": [
    {
      "target": "web-page", // <-- This is a nickname of a resource (a hosting in firebase)
      "public": "public",
      ....
    },
    {
      "target": "web-app",
      "public": "public",
      ....
    },

  ]
}

Now you have to select the target:

firebase target:apply hosting [name] [resource]

For example, let's say the name is "web-page" as in the .json and the name of the hosting you are targeting is "hosting-web", this last one is literally the name you use in Firebase Console:

firebase target:apply hosting web-page hosting-web

For more reference: https://firebase.google.com/docs/cli/targets

0

I faced the same problem when I tried to have main domain and subdomin.

The problem was this message 404, Requested entity was not found because I tried to deploy my subdomain to the hosting server and the resource_id entity does not exist in the file of .firebasesrc I added in the targets filed the same ID of the firebase hosting project ID and the problem has been solved.

YahYa
  • 407
  • 4
  • 9
0

I tried every above solution but it didn,t work. This is how i solve it.

  1. Delete firebase files and dist folder {firebaserc, firebase.jason, dist}

  2. Now build again and follow all steps

smit agravat
  • 223
  • 2
  • 9
0

Firebase doesn't accept groups name with white spaces. e.g:- iOS

enter image description here

iOS SIT Tester always get failed on

Error: failed to distribute to testers/groups: HTTP Error: 404, Requested entity was not found.

wheres JinglePayTesters succeed without any problem.

    # Deploy on Firebase 
  - task: Bash@3
    displayName: "Upload to firebase app distribution"
    inputs:
      targetType: "inline"
      script: |
          npm i -g firebase-tools
          ls -la $(Build.BinariesDirectory)/output/
          firebase appdistribution:distribute  *.ipa \
            --app "$(app_id)" \
            --token "$(firebasetoken)" \
            --groups "JinglePayTesters" \
            --release-notes "From Azure Devops" \
            --debug \
      workingDirectory: '$(Build.BinariesDirectory)/output/'
Samrez Ikram
  • 591
  • 5
  • 15
-1

Had same issue and finally solved it.

1. firebase login 2. firebase use --add (Choose the right Project ID) 3. firebase init (select hosting, than correct Project ID) 4. if needed (npm run build) 5. firebase deploy

Solution was number 2 Choosing the right Project ID Because some how firebase commands was refering automatically to a wrong Project ID

Good Luck

SystemX
  • 481
  • 4
  • 10