Fixes
Firebase errors and fixes
Auth and Google sign-in, Firestore rules and quotas, Storage, App Check, Hosting and unexpected bills. Each page is checked against Firebase’s own docs and says what to try first.
31 Firebase fixes. Also see Firebase Security Rules checker, Backend development and Flutter development.
Guides to these errors in one place: Firebase Auth errors and Firestore and Cloud Functions errors.
- Firebase and Google Cloud billingUnexpected Gemini API charges on a Firebase projectStop the spend first: in the Google Cloud console, check the API metrics to see which key made the calls, then rotate it and restrict or delete every API key that allows the Generative Language API and isn’t a server-side Gemini key. If you can’t find the key fast, you can disable billing on the project, after checking what that takes down. Then move Gemini calls behind your server, turn on App Check for the Firebase services your app uses, set spend cap budgets where Firebase supports them, and keep an alert budget on the whole project. Budget alerts only warn you; they don’t stop charges.
- Firebase Firestore errorFirebaseError: Missing or insufficient permissionsUsually the query asks for more than the rules allow. Firestore rules are not filters: if a query could return even one document the user can’t read, the whole query fails. Add the same conditions to the query that the rule checks. Next most likely: no user is signed in yet when the request runs.
- Firebase security alertFirebase says your Cloud Firestore database isn’t properly securedYour rules let people read or write data they shouldn’t, commonly test-mode rules left on after launch, or rules that only check that someone is signed in. Replace them with rules that check who owns each document, test them in the Rules Playground or the emulator, then deploy. Paste your rules into the free checker first to see which patterns you have.
- Cloud Firestore quota errorWhy does Firestore say I exceeded my quota?On the free quota, Firestore allows 50,000 document reads, 20,000 writes and 20,000 deletes a day, reset around midnight Pacific time. Hitting the limit usually means something reads the same documents again and again: listeners that reconnect, queries with no limit, offsets, security rules that read other documents, or counting by downloading a whole collection. Check the Usage tab, fix the biggest source, or enable billing and set a budget alert, knowing a budget doesn’t cap usage.
- Firebase Authentication errorFirebase: Error (auth/unauthorized-domain)The domain your app runs on isn’t in Firebase’s Authorized domains list. In the Firebase console, go to Authentication, then Settings, then Authorized domains, and add the exact domain, such as app.example.com, without https:// or a path. Every preview URL counts as its own domain, and projects created after April 28, 2025 no longer include localhost.
- Firebase Authentication errorWhy does Firebase sign-in fail with auth/invalid-credential?With email enumeration protection on, which is the default for projects created on or after September 15, 2023, Firebase returns auth/invalid-credential for any invalid email or password, so your app can’t tell which one was wrong. Show one message such as “Email or password is incorrect”, stop branching on user-not-found and wrong-password, and make the forgot-password flow say an email was sent if the account exists. With protection on, a mistyped password gets the same code, so check the password too.
- Android sign-in errorWhy does Google Sign-In fail on Android with error 10?Status 10 means Google says the app is misconfigured. If sign-in works in debug but fails from Google Play, register the app signing key fingerprint from Play Console, not just your upload key. Add the debug fingerprint too, pass the Web client ID as the server client ID, and if you use Firebase, download the updated google-services.json after adding fingerprints.
- Firebase App CheckFirebase App Check is blocking my app’s requestsOnce App Check is enforced, every request without a valid App Check token is rejected. Localhost and CI need a debug token registered in the console, older app versions without the App Check SDK fail until users update, and enforcement can take up to 15 minutes to apply. Check the App Check metrics before enforcing, and keep it on.
- Firebase Auth errorFirebase: auth/requires-recent-login when deleting an accountDeleting an account, setting a primary email address and changing a password need a recent sign-in. If the user signed in too long ago, Firebase fails the action with auth/requires-recent-login. Ask the user to sign in again, pass the new credential to reauthenticateWithCredential, then retry the action. Account deletion can also run on your server with the Admin SDK, which deletes users by uid.
- Firebase Storage errorFirebase Storage “storage/unauthorized” errorYour Cloud Storage Security Rules rejected the request. Check three things: the rules allow this action for this user, the user is signed in before the upload starts, and the file path matches the path in the rule, such as a folder named after the user’s uid. Don’t fix it by allowing everyone: Firebase strongly recommends restricting access.
- Firebase Auth errorFirebase “auth/too-many-requests”Firebase refused the request because a request limit was exceeded. New accounts are limited per IP address, and SMS codes are limited per IP address and per phone number. During testing, use fictional phone numbers from the Firebase console and stop scripts that create accounts in a loop; for real users, wait and retry later.
- Firebase Auth errorFirebase “auth/operation-not-allowed”The sign-in provider your code calls is disabled for this Firebase project. In the Firebase console, open Security, then Authentication, then the Sign-in method tab, and enable the provider: Email/Password, Email link, Phone, Anonymous or a social provider. For email link sign-in, Email/Password must be on as well.
- Firebase Auth errorFirebase: “auth/invalid-api-key”, but only in productionThe deployed build has no Firebase API key, or the wrong one. Add the key to your host’s production environment variables using the prefix your framework exposes to the browser (VITE_ for Vite, NEXT_PUBLIC_ for Next.js, EXPO_PUBLIC_ for Expo), then rebuild and redeploy, since the value is baked in at build time. Copy it from the web app’s config in the Firebase console.
- Firebase phone sign-in errorFirebase phone sign-in: “auth/invalid-app-credential”Firebase couldn’t verify that the request came from your app. On the web, add your live domain to Authorized domains and render the reCAPTCHA verifier before calling signInWithPhoneNumber. On Android, add the app’s SHA-256 fingerprints, including the Play App Signing one, in the Firebase console. On iOS, upload an APNs key and add the URL scheme so the reCAPTCHA fallback works.
- Firebase and Google Cloud billingFirebase bill spike: find what’s spending, then stop itOpen Usage and billing in the Firebase console settings to see which product grew, then that product’s Usage tab for the day it started. Look for a query with no limit, a listener that reloads data, or a Cloud Function that writes to the document that triggered it (for Gemini charges, see the API key page linked below). Fix that code first. Then set an alerts-only budget on the project and spend cap budgets on the services that support them, because an alert email doesn’t stop anything by itself.
- Firebase Auth errorFirebase: “auth/account-exists-with-different-credential”Keep the credential from the error, ask the user to sign in with the method they used before, then call linkWithCredential to add the new provider to that account. After that, both sign-in methods open the same user.
- Firebase Auth errorFirebase: “This operation is restricted to administrators only” (auth/admin-restricted-operation)In the Firebase console, open Authentication, Settings, and look for the user actions options (create and delete) to see whether they are turned off. Turn them back on if users should sign up themselves. If accounts are meant to be created by an admin only, keep it off, create users with the Admin SDK on your server, and show a clear message in the app.
- Firebase Auth errorFirebase: “The action code is invalid” (auth/invalid-action-code)Treat the code as single use. On your handler page, read oobCode from the URL, check it once with verifyPasswordResetCode or checkActionCode, and only then apply it. If the check fails, show a button that sends a new email instead of a raw error.
- Firebase Hosting errorFirebase Hosting: “Page Not Found” after deploy or on refreshSet "public" in firebase.json to the folder your build writes, such as dist or build/web, run the build, then deploy again. If the home page works but other routes fail on refresh, add a rewrite of "**" to "/index.html". If the screen says Site Not Found instead, the site or custom domain usually has no live deploy yet, or the domain isn’t connected.
- Firebase Auth errorFirebase Auth: auth/billing-not-enabled on phone sign-inMove the project to the Blaze plan in the Firebase console and set a budget alert first. A budget alert only notifies you; it doesn’t cap the bill. For development and app review, add fictional phone numbers with fixed codes, which send no SMS. Then retry the sign-in.
- Firebase Storage errorFirebase Storage: 402 or 403 because the project is on the Spark planUpgrade the project to the Blaze plan by linking a Cloud Billing account; no-cost usage still applies. Set a budget alert at the same time. Your files stay in the bucket and come back once the project is on Blaze.
- Firebase Auth errorFirebase Auth: “Unable to process request due to missing initial state”On Firebase Hosting with a custom domain or a web.app subdomain, set authDomain to that domain. On other hosts, proxy /__/auth/ to your firebaseapp.com domain, or switch to signInWithPopup. Add your domain to Authorized domains and https://your-domain/__/auth/handler to the provider’s redirect URIs, then redeploy.
- Firebase Auth errorFirebase Auth: auth/user-token-expiredCatch the error wherever the app gets an ID token or calls Firebase, sign the user out cleanly, and send them to the sign-in screen with a short message. Don’t retry the same session: it can’t be refreshed.
- Firebase Auth errorFirebase Auth: auth/unauthorized-continue-uriIn the Firebase console, open Authentication settings and add the continue URL’s domain under Authorized domains. Then check the url in ActionCodeSettings: it must be a full, valid URL on that domain, and each environment should send its own.
- Firebase Auth errorFirebase Auth: auth/quota-exceededCompare the app’s SMS volume with the Authentication limits page to see which limit was hit. Move testing and App Review to fictional phone numbers, block bots before the SMS is sent, and upgrade to Identity Platform if real traffic needs more SMS per day.
- Firebase migrationFirebase Dynamic Links stopped workingIf you only need to open the app from a link once it is installed, use Android App Links and iOS Universal Links on a domain you control. If you also need deferred deep links, click analytics or short links, Firebase points to other deep-linking providers. For email link sign-in in a mobile app, update the Firebase Auth SDK, remove dynamicLinkDomain, and set linkDomain if the project uses a custom Firebase Hosting link domain. Then ship app updates.
- Firebase Authentication problemWhy don’t users get the Firebase password reset email?Check four things: that the address has an account in Firebase Authentication (with email enumeration protection on, Firebase sends nothing for an unknown address and shows no error), the spam folder, your project’s daily limit for password reset emails, and the sender domain. Sending from your own verified domain, set in the Authentication Templates tab, puts your brand in the From field and lets you add the DNS records that show the email is yours.
- Firebase Cloud Messaging problemWhy aren’t my Firebase push notifications arriving?Check the phone first: on Android 13 and higher a new install has notifications off until the user allows them, and on iPhone the app has to ask and the user can say no. If no iPhone gets anything, check that an APNs authentication key is uploaded in the Firebase console. If messages arrive late, send user-facing ones at high priority. If they stopped for some users, the server may be sending to old device tokens.
- Firebase Authentication problemWhy do my Firebase users keep getting logged out?Firebase sessions are long lived: refresh tokens expire only when the user is deleted or disabled, or after a major account change such as a new password or email address. If users drop at other times, check how the web app stores the session (local, session or none), whether users switch between domains, whether the app reads the current user before Firebase has loaded it, and whether a server keeps the one-hour ID token without refreshing it.
- Firebase Hosting problemWhy does my Firebase site still show the old version after I deploy?Open Hosting in the Firebase console and check the Release history for the site your domain uses. If the latest release isn’t there, the deploy went to a preview channel, another site or another project. If it is there, check that the build ran before the deploy and that firebase.json deploys the build folder, then look for an old service worker or long browser cache headers.
- Firebase performance problemWhy is my Firebase app so slow?Add Performance Monitoring to see which screen or request is slow. Then check that each list query has a limit and pages through results with a cursor, that the Firestore location is near your users, and that slow buttons aren’t waiting on a Cloud Function cold start, which a minimum number of instances reduces. For slow writes to a busy collection, check for document IDs that increase in order.
Looking for another platform? See the other fixes.
A different Firebase error?
Describe it and get a written quote
Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.