Skip to content

Commit 8b53c99

Browse files
committed
fix: use the correct S3 bucket name
1 parent ddc1332 commit 8b53c99

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

app.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,20 @@
5555

5656
def load_aois() -> dict:
5757
"""Fetch aois.json from S3. Returns {} on failure."""
58+
import traceback
59+
bucket = os.getenv("S3_BUCKET_NAME", "environment-monitor")
60+
key_id = os.getenv("AWS_ACCESS_KEY_ID", "NOT SET")
61+
region = os.getenv("AWS_DEFAULT_REGION", "NOT SET")
62+
print(f"DEBUG load_aois: bucket={bucket} region={region} key_id={key_id[:6]}...")
5863
try:
59-
import os
6064
s3 = boto3.client("s3")
61-
bucket = os.getenv("BUCKET_NAME", "env_monitor")
6265
resp = s3.get_object(Bucket=bucket, Key="aois.json")
63-
return json.loads(resp["Body"].read().decode("utf-8"))
66+
data = json.loads(resp["Body"].read().decode("utf-8"))
67+
print(f"DEBUG load_aois: loaded {list(data.keys())} countries")
68+
return data
6469
except Exception as e:
65-
print(f"Could not load aois.json: {e}")
70+
print(f"ERROR load_aois: {e}")
71+
traceback.print_exc()
6672
return {}
6773

6874

@@ -371,6 +377,8 @@ def load_data(aoi_value: str):
371377
country = sel["country"]
372378
aoi_name = sel["aoi_name"]
373379

380+
print(f"DEBUG load_data: country={country} aoi={aoi_name}")
381+
print(f"DEBUG load_data: S3_BUCKET_NAME={os.getenv('S3_BUCKET_NAME')} AWS_KEY={os.getenv('AWS_ACCESS_KEY_ID','NOT SET')[:6]}...")
374382
reader = DataReader(country=country)
375383

376384
# time series

0 commit comments

Comments
 (0)