Firebase hosting deploy error "HTTP Error: 404, Not Found"

Viewed 19067

I don't know if this is related to the recent bump of firebase-tools to 6.0 or not. But I'm unable to deploy my files to a hosting project.

The output after I type firebase deploy:

=== Deploying to 'legofun-8f22d'...

i  deploying hosting
i  hosting[legofun-8f22d]: beginning deploy...
i  hosting[legofun-8f22d]: found 42 files in /_site
(node:10178) UnhandledPromiseRejectionWarning: Error
    at new FirebaseError (/usr/lib/node_modules/firebase-tools/lib/error.js:9:18)
    at Object.reject (/usr/lib/node_modules/firebase-tools/lib/utils.js:67:31)
    at /usr/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:48:26
    at arrayEach (/usr/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:9344:14)
    at module.exports (/usr/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:29:7)
    at _chain (/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:22:40)
    at /usr/lib/node_modules/firebase-tools/lib/deploy/index.js:63:16
    at 
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
(node:10178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10178) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠏  hosting: adding files to version [0/42] (0%)(node:10178) UnhandledPromiseRejectionWarning: Error
    at new FirebaseError (/usr/lib/node_modules/firebase-tools/lib/error.js:9:18)
    at module.exports (/usr/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Request._callback (/usr/lib/node_modules/firebase-tools/lib/api.js:37:35)
    at Request.self.callback (/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request. (/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage. (/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:1083:12)
(node:10178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)

Error: HTTP Error: 404, Not Found
9 Answers

I had the same problem

In my case I fixed it by adding on the firebase.json a dot before /dist on public tag "public": "./dist/my-app-name",

Example of my json

{
  "hosting": {
    "public": "./dist/my-app-name",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

Was facing the same issue, my problem was that I had deleted the project in the console but the source-code was still referencing it hence error 404 - resource not found.

My solution was to:

  • delete .firebaserc file (contains your project alias) located in the root of the project
  • run firebase init and link to your project
  • run firebase deploy again

I had a similar error while trying to follow the Starting with React Most Wanted codelab step "Prepare Firebase Databases"

Error: HTTP Error: 404, Project 'react-most-wanted-ef689' does not exist.

Where 'react-most-wanted-ef689' would contain the name of any project.

It seems that I didn't set up Firestore properly. Missing step:

Activate Firestore for the project and specify the Resource Location Id by following Get started with Cloud Firestore.

I don't think it was in the codelab, so maybe this is something new since the codelab was written.

make sure you choose a default storage location for your firebase project, then deploy again.

here's how:

in firebase project > project overview > gear icon > project settings > Default GCP resource location

You can simply go to firebase console > storage > enable firebase storage.

And It will resolve the issue.

  • Go to your firebase console
  • Go to setting->General and there you will see Default GCP resource location
  • Set GCP location to nam5 (us-central)

Changed the public directory reference. Deploy. It will give error. Changed it back to original. Serve then check. Deploy.

On the bottom of "Firebase Console > Hosting Page" click on "Add another site" and create them with the same name you used for target.

The Only Problem to solve the problem was that the internet connection was not stable.As soon the internet connection was connected correctly so this is how I solved this.

Related