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.
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.
The "not-found" error appears in multiple Firebase services. Check your error logs to determine which service is affected:
// 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 serviceLook 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
Firestore "not-found" errors usually mean the document doesn't exist at the path you specified.
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
Cloud Functions "not-found" (404) errors mean the function isn't deployed or the endpoint URL is wrong.
# List all deployed functions
firebase functions:list
# Deploy a specific function
firebase deploy --only functions:myFunctionNameVerify your function URL follows the correct format:
// 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
Firebase Hosting "not-found" errors mean the site hasn't been deployed or a route doesn't exist.
# List deployed sites
firebase hosting:sites:list
# Deploy your site
firebase deploy --only hosting
# Check deployment history
firebase hosting:listFor single-page apps (React, Angular, Vue), configure firebase.json to handle client-side routing:
{
"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.
Cloud Storage "not-found" errors mean the file doesn't exist or the bucket is wrong.
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)
When using the Firebase Emulator for local development, use localhost URLs instead of production Firebase URLs.
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:
firebase emulators:startNot connecting to the emulator endpoints will cause "not-found" errors because the local data doesn't exist in the production Firebase project.
A "not-found" error might occur if your code is connecting to a different Firebase project than expected.
// 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:
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.
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.
messaging/UNSPECIFIED_ERROR: No additional information available
How to fix "messaging/UNSPECIFIED_ERROR: No additional information available" in Firebase Cloud Messaging
App Check: reCAPTCHA Score Too Low
App Check reCAPTCHA Score Too Low
storage/invalid-url: Invalid URL format for Cloud Storage reference
How to fix invalid URL format in Firebase Cloud Storage
auth/missing-uid: User ID identifier required
How to fix "auth/missing-uid: User ID identifier required" in Firebase
auth/invalid-argument: Invalid parameter passed to method
How to fix "auth/invalid-argument: Invalid parameter passed to method" in Firebase