How to fix not-found in Firebase

FirebaseBEGINNERMEDIUMUpdated Dec 22, 2025· 139 views

The "not-found" error in Firebase occurs when a requested resource, document, function, or endpoint doesn't exist. This is a common error across Firebase services including Firestore, Cloud Functions, Hosting, and Authentication. The fix depends on which Firebase service is throwing the error and why the resource is missing.

Quick fix

Fixes 404

// Firestore example
try {
  const doc = await getDoc(docRef);
  console.log(doc.data());
} catch (error) {
  console.error("Service:", error.code); // firestore/not-found
}

// Cloud Functions example
const response = await fetch('https://region-project.cloudfunctions.net/functionName');
if (!response.ok) {
  console.error("Status:", response.status); // 404
}

// Check error.code or HTTP status to determine the service
  1. Identify which Firebase service is throwing the error
  2. For Firestore: Verify the document path exists
  3. For Cloud Functions: Verify the function is deployed and URL is correct
  4. For Firebase Hosting: Ensure the site is deployed and routes exist
firebase — error
// Firestore example
try {
const doc = await getDoc(docRef);
console.log(doc.data());
} catch (error) {
console.error("Service:", error.code); // firestore/not-found
}
// Cloud Functions example
const response = await fetch('https://region-project.cloudfunctions.net/functionName');
if (!response.ok) {
console.error("Status:", response.status); // 404
}
// Check error.code or HTTP status to determine the service
not-found

What this error means

The "not-found" error (HTTP 404 or gRPC error code 5) indicates that Firebase couldn't locate the resource you requested. This is a generic error that applies across multiple Firebase services: Firestore returns this when a document path doesn't exist, Cloud Functions returns it when a function isn't deployed or the function endpoint URL is incorrect, Firebase Hosting returns it when a deployed site doesn't exist or a page route isn't configured, and Cloud Storage returns it when trying to access a file that doesn't exist. Unlike other errors that indicate temporary issues or permission problems, a "not-found" error means the resource is genuinely missing and requires either: (1) creating the missing resource, (2) fixing the resource path/reference, or (3) checking that you're connecting to the correct Firebase project.

Typical symptoms

  • API calls return HTTP 404 status code with "not-found" message
  • Cloud Firestore queries return "not-found" error when accessing documents
  • Cloud Functions HTTP endpoint returns 404 when calling the function
  • Firebase Hosting deployment shows "Site not found" or 404 page
  • Cloud Storage operations fail with "object not found" error
  • Firebase Emulator shows "NOT FOUND" errors for local development
  • External integrations (Zapier, webhooks) fail with 404 when accessing Firebase resources

Common causes

  1. Firestore: Document path is incorrect or the document was deleted from the database
  2. Cloud Functions: Function hasn't been deployed, function name is misspelled, or using wrong function URL/region
  3. Firebase Hosting: Site hasn't been deployed yet, or deploying to wrong project
  4. Cloud Storage: File path is incorrect, file was deleted, or accessing wrong bucket
  5. Authentication: User account doesn't exist when trying to update or delete user metadata
  6. Realtime Database: Path doesn't exist in the database structure
  7. Wrong Firebase project: Connected to a different Firebase project than expected
  8. Firebase Emulator: Using production URLs instead of emulator endpoint (localhost)

How to fix "not-found"

1Identify which Firebase service is throwing the error

The "not-found" error appears in multiple Firebase services. Check your error logs to determine which service is affected:

javascript
// Firestore example
try {
  const doc = await getDoc(docRef);
  console.log(doc.data());
} catch (error) {
  console.error("Service:", error.code); // firestore/not-found
}

// Cloud Functions example
const response = await fetch('https://region-project.cloudfunctions.net/functionName');
if (!response.ok) {
  console.error("Status:", response.status); // 404
}

// Check error.code or HTTP status to determine the service

Look for:
- firestore/not-found - Firestore document issue
- HTTP 404 - Could be Functions, Hosting, Storage, or API Gateway
- Error context in your logs showing which service endpoint you're calling

2For Firestore: Verify the document path exists

Firestore "not-found" errors usually mean the document doesn't exist at the path you specified.

javascript
import { doc, getDoc } from "firebase/firestore";

const docRef = doc(db, "users", userId);
const docSnap = await getDoc(docRef);

if (docSnap.exists()) {
  console.log("Document data:", docSnap.data());
} else {
  console.log("Document not found - check your path");
  // The document doesn't exist yet - create it if needed
  await setDoc(docRef, { createdAt: new Date() });
}

In Firebase Console, open your Firestore Database and verify:
- The collection name matches exactly (case-sensitive)
- The document ID is correct
- The document hasn't been deleted
- For nested collections, the parent document exists

3For Cloud Functions: Verify the function is deployed and URL is correct

Cloud Functions "not-found" (404) errors mean the function isn't deployed or the endpoint URL is wrong.

bash
# List all deployed functions
firebase functions:list

# Deploy a specific function
firebase deploy --only functions:myFunctionName

Verify your function URL follows the correct format:

javascript
// Correct format
const url = 'https://REGION-PROJECT_ID.cloudfunctions.net/FUNCTION_NAME';

// Example
const url = 'https://us-central1-my-project.cloudfunctions.net/helloWorld';

// For using emulator locally
const url = process.env.NODE_ENV === 'development'
  ? 'http://localhost:5001/my-project/us-central1/helloWorld'
  : 'https://us-central1-my-project.cloudfunctions.net/helloWorld';

Common mistakes:
- Missing the project ID in the URL
- Using wrong region (check in Firebase Console)
- Function hasn't been deployed yet
- Using old function URL format

4For Firebase Hosting: Ensure the site is deployed and routes exist

Firebase Hosting "not-found" errors mean the site hasn't been deployed or a route doesn't exist.

bash
# List deployed sites
firebase hosting:sites:list

# Deploy your site
firebase deploy --only hosting

# Check deployment history
firebase hosting:list

For single-page apps (React, Angular, Vue), configure firebase.json to handle client-side routing:

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

Without this rewrites rule, client-side routes return 404 because the actual files don't exist on the server.

5For Cloud Storage: Verify the file path and bucket

Cloud Storage "not-found" errors mean the file doesn't exist or the bucket is wrong.

javascript
import { ref, getBytes } from "firebase/storage";

const fileRef = ref(storage, 'uploads/myfile.pdf');

try {
  const data = await getBytes(fileRef);
  console.log("File exists:", data);
} catch (error) {
  if (error.code === 'storage/object-not-found') {
    console.log("File doesn't exist - check the path");
    // List files to verify paths
    const folderRef = ref(storage, 'uploads/');
  }
}

Check in Firebase Console under Storage:
- Collection name matches your code
- File was uploaded successfully
- File hasn't been deleted
- You're accessing the correct bucket (default vs. named buckets)

6For Firebase Emulator: Use localhost endpoint instead of production URLs

When using the Firebase Emulator for local development, use localhost URLs instead of production Firebase URLs.

javascript
import { connectFirestoreEmulator, getFirestore } from "firebase/firestore";
import { connectStorageEmulator, getStorage } from "firebase/storage";
import { connectFunctionsEmulator, getFunctions } from "firebase/functions";

const db = getFirestore();
const storage = getStorage();
const functions = getFunctions();

if (process.env.NODE_ENV === 'development') {
  connectFirestoreEmulator(db, 'localhost', 8080);
  connectStorageEmulator(storage, 'localhost', 9199);
  connectFunctionsEmulator(functions, 'localhost', 5001);
}

Start the emulator suite:

bash
firebase emulators:start

Not connecting to the emulator endpoints will cause "not-found" errors because the local data doesn't exist in the production Firebase project.

7Verify you're connected to the correct Firebase project

A "not-found" error might occur if your code is connecting to a different Firebase project than expected.

javascript
// Check which project you're connected to
import { getApp } from "firebase/app";
const app = getApp();
console.log("Project ID:", app.options.projectId);

// In Node.js/Admin SDK
import admin from "firebase-admin";
const projectId = admin.app().options.projectId;
console.log("Connected to project:", projectId);

Verify in your .env.local or config file:

javascript
const firebaseConfig = {
  projectId: "my-correct-project-id",
  // ... other config
};

Fire base Console URL format: https://console.firebase.google.com/project/YOUR_PROJECT_ID

If you're using multiple Firebase projects, ensure you're initializing with the correct config.

Advanced notes

The "not-found" error is one of the most generic Firebase errors because it applies to multiple services. When troubleshooting, first identify which service is throwing the error by examining the error code (firestore/not-found, storage/object-not-found) or HTTP status. For Firestore, enable Firebase Debug logging to see detailed query information: enableLogging(true). For Cloud Functions, check the function logs in Firebase Console under Functions > Logs to see if the function is even being invoked. For Hosting, use firebase hosting:list to confirm your site is deployed. When integrating Firebase with external tools (Zapier, webhooks, third-party APIs), the "not-found" error often means the external tool is using the wrong endpoint URL or the resource doesn't exist in the target Firebase project. Always validate resource paths are case-sensitive and contain no typos.

Frequently asked questions

What does "404" mean?
The "not-found" error (HTTP 404 or gRPC error code 5) indicates that Firebase couldn't locate the resource you requested. This is a generic error that applies across multiple Firebase services: Firestore returns this when a document path doesn't exist, Cloud Functions returns it when a function isn't deployed or the function endpoint URL is incorrect, Firebase Hosting returns it when a deployed site doesn't exist or a page route isn't configured, and Cloud Storage returns it when trying to access a file that doesn't exist. Unlike other errors that indicate temporary issues or permission problems, a "not-found" error means the resource is genuinely missing and requires either: (1) creating the missing resource, (2) fixing the resource path/reference, or (3) checking that you're connecting to the correct Firebase project.
How do I fix "404"?
The "not-found" error in Firebase occurs when a requested resource, document, function, or endpoint doesn't exist. This is a common error across Firebase services including Firestore, Cloud Functions, Hosting, and Authentication. The fix depends on which Firebase service is throwing the error and why the resource is missing.
What causes "404"?
Firestore: Document path is incorrect or the document was deleted from the database Cloud Functions: Function hasn't been deployed, function name is misspelled, or using wrong function URL/region Firebase Hosting: Site hasn't been deployed yet, or deploying to wrong project
Is the "404" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading