The application could not connect to Google Cloud. This could be due to missing authentication credentials or an incomplete database setup in BigQuery.
Most Likely Cause: Missing Environment Variable in Production
Your local environment works because it uses a `.env.local` file. This file is **not deployed**. You must set the `GCP_PROJECT` environment variable in your Firebase App Hosting backend configuration.
Step 1: Authenticate Your Local Environment
gcloud auth application-default loginGCP_PROJECT=your-project-id-hereStep 2: Create BigQuery Dataset and Tables
If authentication is correct, the error might be that the required BigQuery tables do not exist. Go to the BigQuery SQL Workspace and run the queries found in the `docs/schema.sql` and `docs/data.sql` files to create and populate your tables.
If setting the environment variable doesn't work, double-check that your service account has the correct permissions. Your deployed app runs as a **service account**, which needs to be granted permission to access BigQuery.
To fix this, go to the IAM page in your Google Cloud Console and grant the following roles to your service account:
You can find your service account email on the IAM & Admin page. It usually looks like `firebase-app-hosting-compute@...` or `...-compute@developer.gserviceaccount.com`.