Firebase Not Configured

Your application cannot connect to Firebase because the following required environment variable(s) are missing in your .env.local file:

  • NEXT_PUBLIC_FIREBASE_API_KEY
  • NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN
  • NEXT_PUBLIC_FIREBASE_PROJECT_ID
  • NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
  • NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
  • NEXT_PUBLIC_FIREBASE_APP_ID

Troubleshooting Checklist

1. Authorize Your App's Domain (for Published Apps):
If you are seeing an `auth/unauthorized-domain` error after deploying your app, you must add your app's URL to Firebase's list of authorized domains.

  • Go to your Firebase Console → Build → Authentication → Settings tab.
  • Under the "Authorized domains" section, click **Add domain**.
  • Enter the domain of your deployed app (e.g., `your-app-name.web.app`) and click Add.

2. Check `.env.local` & Project Settings:
Go to your Firebase Console → Project Settings (⚙️) → General tab. Scroll to "Your apps" and find your Web App's configuration. Ensure these values in your .env.local file match exactly:

  • NEXT_PUBLIC_FIREBASE_PROJECT_ID
  • NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
  • NEXT_PUBLIC_FIREBASE_API_KEY

3. Check Authentication Methods:
In the Firebase Console, go to Build → Authentication → Sign-in method tab. Ensure **Google** sign-in is **Enabled**.

4. Check Firestore (Database):
Go to Build → Firestore Database. Ensure it has been **created** (if not, create one in **Native Mode**). Then, check the **Rules** tab and make sure they allow access, for example: allow read, write: if request.auth != null;

5. Check Cloud Storage:
Go to Build → Storage. Ensure it has been **activated**. Then, check the **Rules** tab and ensure they are also set to allow access: allow read, write: if request.auth != null;

Crucial Step for Firebase Studio

After you create or edit the .env.local file, you must restart the backend in Firebase Studio for the changes to apply.