I recently developed a web app mainly using Gemini AI inside firebase workspace studio. I’ve been using it for a while with minor issues here and there, but went to add a new feature inside the web app. I connected to Firebase Database and ever since then I’ve got a 404 error code. I have run a GIT reset to pull my last known working commit ID that had no 404 error or issues. I followed that by clearing cache GIT, and a build command for successful build. Still 404. I then ran GIT status & git clean -n after contacting support, no issues on any added files or corrupted files. I’m lost at this point, and if anyone has any suggestions or help that would be great as I need this web app working ASAP. This is my first time creating one of these.
Where re you getting the 404? In the preview window or a separate tab in the browser?
That sounds incredibly frustrating, especially when you’re on a deadline. A persistent 404 after you’ve reset your code is a classic (and very confusing!) problem.
Based on your description, the most likely issue is a mismatch between your local code and the deployed code.
Your git reset command did a great job of fixing the code on your computer. However, your live website on Firebase Hosting is likely still serving the old, broken version. You need to re-deploy the working code to update the live site.
Here is the step-by-step process I would follow.
1. Confirm Your Local Code is Clean
You’ve already done this, but let’s just be 100% sure you are on the correct commit.
Bash
# Double-check you are on the right commit
git log -n 1
# If not, reset again
git reset --hard <your-last-working-commit-id>
2. Re-build Your Application
Run the build command you mentioned. This takes your (now fixed) source code and prepares it for deployment (e.g., creates the build or dist folder).
Bash
# Use whatever your project's build command is
npm run build
3. Deploy the Fix to Firebase
This is the most critical step you’re likely missing. You need to push your newly built, working code up to Firebase Hosting.
Bash
# This will deploy your app to your live URL
firebase deploy
# --- OR ---
# If you ONLY want to deploy the website and not other services
firebase deploy --only hosting
After the deployment finishes successfully, clear your browser cache one more time and check your website. This resolves the issue 9 times out of 10.
If You Still Get a 404 Error…
If a fresh deploy doesn’t fix it, the problem is likely in your Firebase configuration. This can happen if the new feature you added (connecting to Firebase Database) also involved adding a Cloud Function or Genkit flow that your app now relies on.
Check your firebase.json file:
-
Check
hosting.public: Make sure this directory (e.g.,"public": "build"or"public": "dist") matches the folder yournpm run buildcommand creates. -
Check
hosting.rewrites: When you added the new feature, did you add a rewrite rule?-
Example: You might have added a rule like
"rewrites": [ { "source": "/api/**", "function": "myNewFunction" } ]. -
If that function (
myNewFunction) failed to deploy or was removed by yourgit reset, the rewrite will point to nothing, causing a 404 error.
-
If you’re still stuck, please post the contents of your firebase.json file here (just be sure to remove any sensitive project names or IDs). That will give us a much better idea of what’s going on.
Long story short, I was able to do some digging and used GIT commands to get the web app back up and running. However, it’s still not working properly. Like I said this is my first time using one of these. I’m using it for a time clock system for my company, so currently the guys can’t use my clock in/out system which is killing me. But I’ve got the app back up, but I can’t log in anymore, not sure why. Trying right now with the Gemini to get it fixed, but my users are store on a firestore database, and I used to could log in just fine before the Gemini prompted me to connect to some other firebase database and I clicked it, once I did that my log ins won’t work and idk why. Any help on this would be appreciated! Thanks.
Thanks for that information, see my most recent reply where I’m at now. Thanks!