Edwin Salguero commited on
Commit
081f523
·
1 Parent(s): 22dd4c3

Add error handling and debug logging for AWS client initialization to prevent UnboundLocalError

Browse files
Files changed (1) hide show
  1. frontend/app.py +17 -2
frontend/app.py CHANGED
@@ -438,8 +438,23 @@ def main():
438
  st.stop()
439
 
440
  # Initialize AWS clients and config for real data mode
441
- s3_client, lambda_client = init_aws_clients()
442
- config = load_app_config()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
 
444
  # Force analytics to be available if loading succeeded
445
  if ANALYTICS_AVAILABLE:
 
438
  st.stop()
439
 
440
  # Initialize AWS clients and config for real data mode
441
+ try:
442
+ s3_client, lambda_client = init_aws_clients()
443
+ print(f"DEBUG: AWS clients initialized - s3_client: {s3_client is not None}, lambda_client: {lambda_client is not None}")
444
+ except Exception as e:
445
+ print(f"DEBUG: Failed to initialize AWS clients: {e}")
446
+ s3_client, lambda_client = None, None
447
+
448
+ try:
449
+ config = load_app_config()
450
+ print(f"DEBUG: App config loaded: {config}")
451
+ except Exception as e:
452
+ print(f"DEBUG: Failed to load app config: {e}")
453
+ config = {
454
+ 's3_bucket': 'fredmlv1',
455
+ 'lambda_function': 'fred-ml-processor',
456
+ 'api_endpoint': 'http://localhost:8000'
457
+ }
458
 
459
  # Force analytics to be available if loading succeeded
460
  if ANALYTICS_AVAILABLE: