Firebase hosting deployment error Error: Error: 404, Requested entity was not found
Asked Answered
H

11

18

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
Hoye answered 16/7, 2020 at 7:48 Comment(0)
N
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

Napiform answered 16/7, 2020 at 7:51 Comment(0)
L
53

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

{
  "hosting": {
    "site": "my-app-id",
    "public": "app",
    ...
    ...
}
Leaky answered 10/12, 2020 at 6:19 Comment(2)
yes, that did work, thank you so much!Forehead
It absolutely worked!Timetable
S
7

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"
  }
]
}
Superorganic answered 17/3, 2022 at 1:39 Comment(1)
If you have followed the documentation and still have this issue, then this is the correct answer.Threedimensional
C
2

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

npm install -g firebase-tools

Christner answered 28/3, 2021 at 5:4 Comment(0)
N
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

Napiform answered 16/7, 2020 at 7:51 Comment(0)
S
1

I received the same error due to an incorrectly configured .firebaserc file. I had mixed up the name of my project with the name of the hosting target. A correctly configured file would look something like this:

{
  "projects": {
    "default": "dev-project",
    "dev": "dev-project",
    "prod": "prod-project"
  },
  "targets": {
    "prod-project": {
      "hosting": {
        "app-one": [
          "prod-project-hosting-target-for-app-one"
        ],
        "app-two": [
          "prod-project-hosting-target-for-app-two"
        ]
      }
    },
    "dev-project": {
      "hosting": {
        "app-one": [
          "dev-project-hosting-target-for-app-one"
        ],
        "app-two": [
          "dev-project-hosting-target-for-app-two"
        ]
      }
    }
  }
}
Sprayberry answered 28/12, 2023 at 0:9 Comment(0)
F
0

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

Fry answered 16/9, 2020 at 3:8 Comment(0)
L
0

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

Lychnis answered 22/12, 2020 at 11:52 Comment(0)
S
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

Subconscious answered 19/3, 2021 at 21:20 Comment(0)
A
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.

Andros answered 9/4, 2022 at 13:59 Comment(0)
M
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/'
Merridie answered 12/9, 2022 at 8:31 Comment(0)
T
-1

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

Tumer answered 25/4, 2022 at 6:50 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.