## What was done: ✅ Fixed Firebase Admin initialization to use default credentials for Firebase Functions ✅ Updated frontend to use correct Firebase Functions URL (was using Cloud Run URL) ✅ Added comprehensive debugging to authentication middleware ✅ Added debugging to file upload middleware and CORS handling ✅ Added debug buttons to frontend for troubleshooting authentication ✅ Enhanced error handling and logging throughout the stack ## Current issues: ❌ Document upload still returns 400 Bad Request despite authentication working ❌ GET requests work fine (200 OK) but POST upload requests fail ❌ Frontend authentication is working correctly (valid JWT tokens) ❌ Backend authentication middleware is working (rejects invalid tokens) ❌ CORS is configured correctly and allowing requests ## Root cause analysis: - Authentication is NOT the issue (tokens are valid, GET requests work) - The problem appears to be in the file upload handling or multer configuration - Request reaches the server but fails during upload processing - Need to identify exactly where in the upload pipeline the failure occurs ## TODO next steps: 1. 🔍 Check Firebase Functions logs after next upload attempt to see debugging output 2. 🔍 Verify if request reaches upload middleware (look for '�� Upload middleware called' logs) 3. 🔍 Check if file validation is triggered (look for '🔍 File filter called' logs) 4. 🔍 Identify specific error in upload pipeline (multer, file processing, etc.) 5. 🔍 Test with smaller file or different file type to isolate issue 6. 🔍 Check if issue is with Firebase Functions file size limits or timeout 7. 🔍 Verify multer configuration and file handling in Firebase Functions environment ## Technical details: - Frontend: https://cim-summarizer.web.app - Backend: https://us-central1-cim-summarizer.cloudfunctions.net/api - Authentication: Firebase Auth with JWT tokens (working correctly) - File upload: Multer with memory storage for immediate GCS upload - Debug buttons available in production frontend for troubleshooting
75 lines
2.0 KiB
Plaintext
75 lines
2.0 KiB
Plaintext
# Backend Environment Variables - Cloud-Only Configuration
|
|
|
|
# App Configuration
|
|
NODE_ENV=development
|
|
PORT=5000
|
|
|
|
# Supabase Configuration (Required)
|
|
SUPABASE_URL=your-supabase-project-url
|
|
SUPABASE_ANON_KEY=your-supabase-anon-key
|
|
SUPABASE_SERVICE_KEY=your-supabase-service-key
|
|
|
|
# Vector Database Configuration
|
|
VECTOR_PROVIDER=supabase
|
|
|
|
# LLM Configuration
|
|
LLM_PROVIDER=anthropic
|
|
ANTHROPIC_API_KEY=your-anthropic-api-key
|
|
OPENAI_API_KEY=your-openai-api-key
|
|
LLM_MODEL=claude-3-5-sonnet-20241022
|
|
LLM_MAX_TOKENS=4000
|
|
LLM_TEMPERATURE=0.1
|
|
|
|
# JWT Configuration (for compatibility)
|
|
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
|
|
JWT_REFRESH_SECRET=your-super-secret-refresh-key-change-this-in-production
|
|
|
|
# Google Cloud Document AI Configuration
|
|
GCLOUD_PROJECT_ID=your-gcloud-project-id
|
|
DOCUMENT_AI_LOCATION=us
|
|
DOCUMENT_AI_PROCESSOR_ID=your-processor-id
|
|
GCS_BUCKET_NAME=your-gcs-bucket-name
|
|
DOCUMENT_AI_OUTPUT_BUCKET_NAME=your-document-ai-output-bucket
|
|
GOOGLE_APPLICATION_CREDENTIALS=./serviceAccountKey.json
|
|
|
|
# Processing Strategy
|
|
PROCESSING_STRATEGY=document_ai_genkit
|
|
|
|
# File Upload Configuration
|
|
MAX_FILE_SIZE=104857600
|
|
ALLOWED_FILE_TYPES=application/pdf
|
|
|
|
# Security Configuration
|
|
BCRYPT_ROUNDS=12
|
|
RATE_LIMIT_WINDOW_MS=900000
|
|
RATE_LIMIT_MAX_REQUESTS=100
|
|
|
|
# Logging Configuration
|
|
LOG_LEVEL=info
|
|
LOG_FILE=logs/app.log
|
|
|
|
# Agentic RAG Configuration
|
|
AGENTIC_RAG_ENABLED=true
|
|
AGENTIC_RAG_MAX_AGENTS=6
|
|
AGENTIC_RAG_PARALLEL_PROCESSING=true
|
|
AGENTIC_RAG_VALIDATION_STRICT=true
|
|
AGENTIC_RAG_RETRY_ATTEMPTS=3
|
|
AGENTIC_RAG_TIMEOUT_PER_AGENT=60000
|
|
|
|
# Agent Configuration
|
|
AGENT_DOCUMENT_UNDERSTANDING_ENABLED=true
|
|
AGENT_FINANCIAL_ANALYSIS_ENABLED=true
|
|
AGENT_MARKET_ANALYSIS_ENABLED=true
|
|
AGENT_INVESTMENT_THESIS_ENABLED=true
|
|
AGENT_SYNTHESIS_ENABLED=true
|
|
AGENT_VALIDATION_ENABLED=true
|
|
|
|
# Quality Control
|
|
AGENTIC_RAG_QUALITY_THRESHOLD=0.8
|
|
AGENTIC_RAG_COMPLETENESS_THRESHOLD=0.9
|
|
AGENTIC_RAG_CONSISTENCY_CHECK=true
|
|
|
|
# Monitoring and Logging
|
|
AGENTIC_RAG_DETAILED_LOGGING=true
|
|
AGENTIC_RAG_PERFORMANCE_TRACKING=true
|
|
AGENTIC_RAG_ERROR_REPORTING=true |