Files
cim_summary/backend/firebase-functions-env.md
Jon c77fe0e089 Add comprehensive email debugging summary and enhanced logging
- Created EMAIL_DEBUG_SUMMARY.md with detailed analysis of email service issue
- Added enhanced logging to admin routes and email service
- Identified root cause: malformed email address concatenation
- Documented all debugging attempts and next steps
- Added route access logging to trace request flow
- Removed problematic catch-all route that was causing 404s
2025-08-14 20:41:04 -04:00

2.0 KiB

Firebase Functions Environment Variables

When deploying to Firebase Functions, make sure to set these environment variables:

Required Environment Variables

# Supabase Configuration (for database)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-supabase-anon-key
SUPABASE_SERVICE_KEY=your-supabase-service-key

# Google Cloud Configuration
GCLOUD_PROJECT_ID=your-project-id
DOCUMENT_AI_LOCATION=us
DOCUMENT_AI_PROCESSOR_ID=your-processor-id
GCS_BUCKET_NAME=your-gcs-bucket
DOCUMENT_AI_OUTPUT_BUCKET_NAME=your-output-bucket

# LLM Configuration
LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=your-anthropic-key
OPENAI_API_KEY=your-openai-key

# JWT Configuration
JWT_SECRET=your-jwt-secret
JWT_REFRESH_SECRET=your-refresh-secret

# Firebase Configuration
FB_PROJECT_ID=your-firebase-project-id
FB_STORAGE_BUCKET=your-firebase-bucket

Setting Environment Variables in Firebase

Option 1: Firebase CLI

firebase functions:config:set supabase.url="https://your-project.supabase.co"
firebase functions:config:set supabase.anon_key="your-anon-key"
firebase functions:config:set supabase.service_key="your-service-key"
# ... set other variables

Option 2: Firebase Console

  1. Go to Firebase Console
  2. Select your project
  3. Go to Functions > Configuration
  4. Add environment variables in the "Environment variables" section

Option 3: .env file (for local development)

Create a .env file in the backend directory with all the variables above.

Database Setup for Firebase

After deploying to Firebase, run the database setup:

# For Firebase deployment
npm run db:setup-sharing-firebase

Important Notes

  1. Service Account: Firebase Functions automatically use the default service account
  2. Database Connection: Uses direct PostgreSQL connection to Supabase
  3. Authentication: Firebase Auth tokens are automatically handled
  4. Cold Starts: Consider using Firebase Functions with higher memory allocation for better performance